Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem Setting Focus

Status
Not open for further replies.

ggrewe

IS-IT--Management
Jul 10, 2001
169
US
I have created a base class with a method of "Edit_Records". In that method, the last line sets focus to some object on the form. What I would like to do is populate a variable on the form (roSetFocus) so when the edit method is called, I can do something like :
Code:
THISFORM.roSetFocus.SetFocus()

I would populate this variable in the Init method of the form, so that I would not have to change the inherited code for each form the that is based on this class.

I have tried several different syntaxes, but to no avail. Thanks in advance for the help.



Greg Grewe
West Chester, Ohio
 
Thanks much Mike, that did it! Enjoy the rest of your evening....



Greg Grewe
West Chester, Ohio
 
Hi Greg.

What I would like to do is populate a variable on the form (roSetFocus) so when the edit method is called, I can do something like :

Is your form property of character datatype (is it the name of the control?) or is it an object reference? If it is an object reference, the you can just set it like this:

Code:
Thsiform.roSetFocus.SetFocus()

If it is a character string, when you set it, you need to include the fully qualified containership path to the object ( i.e,; [Thisform.Pageframe1.Page1.text1] ). Then you can use the method suggested by Mike Lewis.

However, if you have to write the code in the init() to set the property, I do not see what you are saving. Why don't you just SetFocus to the control and be done with it. You still have to write code in every instance and doing it your way just slows things down.

Marcia G. Akins
 
Marcia,

I am sorry it took so long to reply, I was kind of laid up for a while...

Anyway, to answer your question, I created a class with the property roSetFocus. Within several methods of that class (such as edit records, add records, etc.) instead of manually updating the code to setfocus to a specific field, as long as I populate the roSetFOcus in INIT, then I do not have to remember to do it in the other methods. I know I could change the tab order, but this seems to work out better for me.

I hope that makes some sense. Thanks again.



Greg Grewe
West Chester, Ohio
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top