Desmond,
I quote from James Booth's web page:

http://www.jamesbooth.com/eventorder.htm

************************
Getting and losing focus

There are a number of event-methods and methods associated with a control 
receiving and/or losing focus.  The event-methods related to receiving and 
losing focus are When (event-method), GotFocus (event-method), SetFocus 
(method), Valid (event-method), and LostFocus (event-method).

To take the best advantage of the event model in Visual FoxPro it is necessary 
to clearly understand the event-methods that fire and the point in time that 
they fire. In the process of receiving focus the sequence of event-methods is 1 
- When and then 2 - GotFocus.

The When event-method can be thought of as the place to determine whether or 
not focus will be allowed to arrive at the control.  Returning a value of .F. 
from the When event-method will prevent focus from arriving at the control. 
Once the When event returns a value of .T., the GotFocus will fire (if the When 
returns .F. the GotFocus does not fire). The GotFocus can be classified as the 
event-method in which you prepare for the control to receive focus, since it 
only fires if the control is going to receive focus.

The SetFocus method also plays a role in that it has the default behavior of 
beginning the process of receiving focus for a control. A control's SetFocus 
method is similar to the FoxPro 2.X _curobj variable.

There are two controls that act slightly different in respect to the When 
event-method, these are the ListBox and the ComboBox. With these two controls, 
the When fires as it does for other controls, as focus arrives at the object 
and before the object actually receives focus.  The When can return .F. to 
prevent focus from arriving on that object.

However, with lists and combos, the When also fires every time the currently 
selected item changes. Because of this behavior, it is important to be careful 
with what code you put in a list or combo's When event-method. You should be 
aware that the When will fire multiple times for these two controls as the user 
navigates through their list.

The process of losing focus is similar. There are two event-methods involved, 
Valid and LostFocus.  The Valid fires first and can be used to prevent focus 
from leaving the control.  A return of .F. from the Valid will cause the 
control to retain the focus. A return of .T. from the Valid will allow focus to 
leave the control and thusly will fire the LostFocus. Like the When and 
GotFocus, the Valid can be used to decide if focus should be allowed to leave 
the control and the LostFocus can be used to react to a control losing focus.

*************************

Does this help?

Dave

-----Original Message-----
From: ProFox [mailto:[email protected]] On Behalf Of Desmond Lloyd
Sent: 04 March 2015 19:26
To: ProFox Email List
Subject: VFP6: Tab Order Issue (I think)

Good Afternoon,

Have an odd problem with a form.  Have an edit button with the caption Edit,  
Clicking on the edit button changes the caption to Save,  turn off some other 
buttons,  enable some controls and set focus to a combo control,  works great.  
The only issue is that if I press enter it executes the click code in the edit 
button,  with the caption set to save my update procedure executes.  If I tab 
out of the control it goes to the next field properly.

Even tried setting focus to a text box (thinking for some reason the combo 
control was the issue),  no joy...

I have another form that I do the same thing,  setting focus on a text box (in 
this case) and if I press enter it goes to the next field????

While I am it,  in the lost focus of the combo box,  if the value is changed I 
enable a previously disabled control box,  works fine if I tab out of the comb 
box,  but if I change the value in the combo box and click on the control that 
should be enabled by the lost focus,  no joy!

What am I missing?
Any input would be most appreciated!

Regards,
Desmond


--- StripMime Report -- processed MIME parts --- multipart/alternative
  text/plain (text body -- kept)
  text/html
---

[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to