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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Modifying mulitple controls

Status
Not open for further replies.

aiden

Programmer
Apr 23, 2001
27
CA
Hi,

I recently took over an application and I would like to alter the features of the controls on the forms. There are many textboxes (~50) on about 10 forms. I want to add code to the 'gotfocus' event so the textboxes highlight when they receives focus. There is other code behind these textboxes so I don't want to replace them with a new textbox based on a custom class. Is there anyway to programmatically add this code to the textboxes or do I have to do it manually?

Thanks in advance.

 
aiden

Set the SelectOnEntry of the textbox to .t.? Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
aiden

Or in the Init of the form:
thisform.SetAll("selectonentry",.t.,"textbox")

To do them all together, providing the class is "textbox". Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Hi Mark,

'Selectonentry' doesn't give me the desired effect. It will only highlight the contents of the textbox when you tab into the field. I want to highlight the contents even when I click the field. I usually add the following code to my textboxes:

TextBox::GotFocus()
This.SelStart = 0
This.SelLength = 999
NODEFAULT

However, I'm trying to avoid manually adding this code to the several hundred existing textboxes in this application.

Thanks.
 
One reason it's so important to not use the VFP base classes directly is your situation. It takes almost no time to create a set of classes that use the base classes so you can easily change the funtionality of any given class. In fact, it's best to subclass two levels to handle your company's class behaviour and then one set for each application.

There are tools on the UT ( to quickly create these class sets if you don't want to take the time, and there are also tools to modify the classes on existing forms. Besides the UT, you might want to check out the free tools at
Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top