Information générale
Catégorie:
Gestionnaire d'écran & Écrans
>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).
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement