>I know about this point and did so before, but since awhile I found that NODEFAULT is not necessary here.
>
>If we make a simple test:
>
>Create a form,
>Drop 5 textboxes on the form.
>In text4.LostFocus() put
>
>this.parent.text2.SetFocus()
>
>In my tests this works identically to
>
>* text4.LostFocus()
>this.parent.text1.SetFocus()
>NODEFAULT
>
>and NODEFAULT presence seems to have no effect on successful SetFocus to text2 textbox, no matter if you use Tab, Enter, clicking on another control or pressing Esc in order to leave the text4 textbox. I tested in VFP 3, 5, and 6 and it all worked the same for me. I also tried with adding the button with .Cancel = .t. and the button with .Default = .t.
>
>The only case found when SetFocus was not set, is when you are tracing the code in the Debugger and have some code immediately
after the line
>
>this.parent.text1.Setfocus()
>myVar1 = 0
>myVar2 = 1
>
>In this case the focus goes to the next control and adding NODEFAULT also has no effect on this behaviour.
>
>If we are not tracing the code - Setfocus() from LostFocus() works fine, and the code after SetFocus line is executed too.
>
>So, my point is that NODEFAULT is not necessary when you are trying to SetFocus from the LostFocus() event.
The one situation it is required is when you are going nowhere. Like
This.Setfocus in the Lostfocus
will fire Gotfocus and then move on to next control, so requires a NoDefault.
Of course in that case, all you need is the NoDefault, rather than a Setfocus, unless you want to fire the Gotfocus.
The Anonymous Bureaucrat,
and frankly, quite content not to be
a member of either major US political party.