100 <10*@100.com> wrote in message
news:Og**************@tk2msftngp13.phx.gbl...
Hi Patric,
A bunch of events are fired when the control loses the focus.
The right order is:
Leave
Validating
Validated
LostFocus
According to the event order above. You will receive LostFocus only if the
focus is actually lost and Leave as a inforamtion when request for
changing the focus has arrived. Validating event handler can cancel the request and
it is posible to receive Leave, but not to receive LostFocus.
Anyway there is a bug in the framework and this order is valid only when
the focus has been chaged using the TAB key to circle among the controls. If
you use the mouse for changing the focus (which is most often used I think)
the event order is:
LostFocus
Leave
Validating
Validated
You can see that you will receive LostFocus first and then the others
events. Validating event handler can cancel the operation and the focus
won't be changed even though you have received LostFocus.
So, the LostFocus is not reliable.
I haven't seen good workaround for this bug. Some people suggest catching
Windows messages, other using some special flags inside the form class.
But I think there is no universal cure for this. Until MS don't fix this the
best workaround depends on the application logic.
Hi 100,
This is very interesting. However, what you
write is not totally within the scope of my
understanding at this point in time. Are
there any references for me to look at
on what you are discussing?
I have applied what mk advised me to do,
and that works fine.So I am very pleased.
Greetings,
--
Patrick De Ridder
bg****@freeler.nl