Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Set all Gotfocus and LostFocus to
Message
De
30/03/2005 11:25:29
 
 
À
30/03/2005 11:04:08
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Novell 5.x
Database:
Visual FoxPro
Divers
Thread ID:
00999921
Message ID:
00999952
Vues:
21
>>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
Malcolm Greene
Brooks-Durham
mgreene@bdurham.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform