>>If you're running VFP 8 or above, you could also use BindEvents() in your Form.Init() to redirect these events to a form method that would handle these activities. This way you don't need another subclassed control and you don't need to spread logic amongst multiple controls.
In form Init:
with ThisForm
* do this for each control on the form whose got/lostfocus
* you want to handle in a single form method
bindevent( .myControl1, "GotFocus", ThisForm, "myGotFocus" )
bindevent( .myControl1, "LostFocus", ThisForm, "myLostFocus" )
...
bindevent( .myControlN, "GotFocus", ThisForm, "myGotFocus" )
bindevent( .myControlN, "LostFocus", ThisForm, "myLostFocus" )
endwith
Then add custom myGotFocus and myLostFocus methods to your form that handle the logic you want. THIS will not be available in these methods, but you can create your own THIS like reference via:
local loThis
loThis = _screen.activeform.activecontrol
Use this loThis variable to reference the control whose event got redirected to your form level method.
This is just an example - you could also redirect your bindevent() calls to other objects besides your form.
Malcolm