> Yes, I check. ThisForm.ActiveObject.Name return name of the object wich had focus before (I tried on the simple form, not on the page frame). I just put
>=MessageBox(ThisForm.ActiveObject.Name)
>dodefault() into when event of one of my buttons. Sometimes I saw this message and nothing happened then, sometimes click event fired and I didn't see this message.
I told you it reacts differently depending on the way you access the button. Too unreliable.
>>
>>* button.when
>>thisform.LastActive=thisform.activecontrol
>
>>
>>* button.lostfocus
>>
>>thisform.LastActive.Setfocus
>>nodefault
>
> I think we need to use macro here like:
>
>thisform.&LastActive..Setfocus
>and this code should be in click event after dodefault()
No macro - it would not keep any names, it would keep an object referrence (thisform.activecontrol returns an object referrence), and this referrence behaves as an alias to the real object, and you can call its methods.
>
>
>>Alternative solution would be to put the button on a toolbar - that way it never actually receives focus, so the focus remains on the control where it was.
>
> Yes, I actually speak about our navstand class (navigations, set order, set filter, search, quit, etc.), so it could be a property of this class LastActive and on all (except quit, of course) buttons click event code we will write:
>
>** some code
>Local lcLastActive
>lcLastActive=this.parent.LastActive
Again - you need only one ThisForm.LastActive property to hold a reference to any object on the form, so, again, no macros needed.
> But here is the potential problem - if our controls are not on the form, but on the page or another container object - how can we operate here?
The object in the pageframe would create a reference to itself in thisform.LastActive, no matter where it's contained. Just try it.