VFP 6, Classes and SetFocus 
Author Message
 VFP 6, Classes and SetFocus

I have just started to appreciate and use classes in my application.  I have
created a class based on command button that edits a customer.  I use this
class in several forms, but after the click method has run I want to set
focus to different controls in each application.  I cannot set focus in the
class code because the object that receives the focus may not exist in the
given form.  How can I use the command button and still can the code for set
focus?  Thanks.


Fri, 02 Sep 2005 01:54:59 GMT  
 VFP 6, Classes and SetFocus
John,

Here's two options

1) create a custom property on the button cSetFocusControl, then in each
form you can simply set the value to the name of the control that you want
focus to go to. The button class can then have the code:

do clientedit stuff
loControl = eval( "thisform." + this.cSetFocusControl )
loControl.SetFocus()

2) in each form you simply override the button click to extend it's
functionality:

dodefault() && causes the class code to execute which does the client edit
thisform.SomeOtherControl.SetFocus()

--
df - Microsoft MVP FoxPro http://www.geocities.com/df_foxpro


Quote:
> I have just started to appreciate and use classes in my application.  I
have
> created a class based on command button that edits a customer.  I use this
> class in several forms, but after the click method has run I want to set
> focus to different controls in each application.  I cannot set focus in
the
> class code because the object that receives the focus may not exist in the
> given form.  How can I use the command button and still can the code for
set
> focus?  Thanks.



Fri, 02 Sep 2005 02:22:55 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. VFP 6 Class browser bombs when opening a VFP 5 class library

2. Managing Classes with Class Browser - I cannot copy a class from one class library to another

3. VFP - Adding Classes to Class Libraries from .prg files

4. VFP 3.0 Newbie Question: LostFocus and SetFocus Methods

5. How to setfocus to a grid in VFP 6

6. VFP 5 - SetFocus() question

7. Setfocus from within a toolbar in VFP 3.0

8. Another setfocus problem in VFP 3

9. VFP 3.0 Newbie question: LostFocus and SetFocus methods

10. VFP SetFocus Method Won't Work!

11. VFP 3.0 - Need help with SetFocus

12. VFP - Is SetFocus Preemptive?

 

 
Powered by phpBB® Forum Software