Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Stupid UI Tricks
Message
From
01/02/2000 14:30:55
 
 
To
01/02/2000 13:54:07
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00325732
Message ID:
00325751
Views:
22
>Hi all,
>
>Reviewing another application that is giving me heartburn. There is a trick I learned a while back that I would like to share and why it's important.
>
>When data on a form is being edited, it's a good idea to SetFocus to the first control. This may seem like a nobrainer, but if you don't do it and the user hits "Add" or "Modify" then the focus never leaves that commandbutton.
>
>A really easy way to do it is to add a custom property to your form class such as "FirstEditControl" and default it to blank. In the instances of the form class, you can fill it in with "ThisForm.txtFirstName" or whatever and then put the following code in the Add or Modify method as the last thing to do:
>IF !EMPTY(ThisForm.FirstEditControl)
>   cEditControl=ThisForm.FirstEditControl
>   &cEditControl..SetFocus()
>   &cEditControl..Refresh()
>ENDIF
For the macroexansion-phobic like me:

oEditControl = EVAL('thisform.'+thisform.FirstEditControl)
oEditControl.SetFocus()
oEditControl.Refresh()
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform