General information
Category:
Forms & Form designer
>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).
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only