Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Previous Active object
Message
 
 
À
01/08/2001 15:06:52
Nancy Folsom
Pixel Dust Industries
Washington, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00538416
Message ID:
00538563
Vues:
11
>>I have a form with many objects (textboxes, checkboxes, etc) and on some of my commandboxes, I would like to setfocus to the
>>object that had the control when the command was clicked. I can do this with programming by saving the object name and parents
>>when the object gets the focus, but is there another way. I am using VFP6.
>
>Actually, I'd save the object to form property, thisform.oLastControl, and then in the lostFocus of every base class you have (you are using base classes, right? *s*) do something like thisform.oLastControl = this. Then in the command button's click, after you do your work you could THISFORM.oLastControl.SetFocus(). This should work fine if you take care of a couple of details.
>
>Set the property thisform.oLastControl to .NULL. in the form destroy.
>
>Make sure you initialize the property when the form initializes in case that's the first thing a user does, or you'll get an error.
>
>Don't ever programmatically call the click() method from a valid().
>
>Other than that, no, there really isn't another way to do it (that I can think of).

Slightly different way of doing it would be to save thisform.ActiveControl in commandbutton when event, e.g. thisform.LastActive=thisform.ActiveControl
In the click of command button you can restore focus. But you should check, if thisform.LastActive is an object first.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform