>>Hi,
>>
>>In the LostFocus event of a TextBox, I plan to code actions depend on the next control who is receiving focus.
>>
>>Something like:
>>
>>If <control receving focus is control A or contrl B> then
>> do nothing
>>else
>> populate a listbox with values
>>endif
>>
>>
>>I am aware that if control A's when event returns .F. then the jump of focus to it will fail, but in my case I am not interested in what will be the outcome of the focus switch, I just need to know where the focus is heading...
>>
>>Is there a way I can find out which control VFP is attempting to set focus to?
>
>Add a method in the form wich populates that listbox.
>Then in Every control GotFocus event, where you need this listbox to be populated, just call that method.
My form have quite a number of controls.
Your idea should work fine if I have "exclude all other controls, get the listbox populated with values only if focus is about to be set to 1 or 2 controls" scenario.
However, in my case, it is exactly the reverse scenario, I want to "do nothing" only for 1 or 2 controls and get the listbox populated with values for the rest of controls.
If I were to do it as you have suggested, that means I will have to add code to GetFocus event of almost all controls in the form and I think I can easily forget about adding the same code, if in the future I need to add new control to the form.