> ...
>I want to some generic solution, which will work in VFP 9 and up. Unfortunately the When event does not allow to call the SetFocus method of another object. Also I did not find a way to address an object by its TabIndex. This would allow me to call the next or previous object in the tab sequence.
How about GotFocus() instead of When()? I am not sure if this one will allow a SetFocus(), but you can try.
I guess the idea is for When() to execute before an object obtains the focus ("Am I allowed to receive the focus?"), and GotFocus(), after it receives the focus.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)