Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Stupid UI Tricks
Message
From
01/02/2000 14:44:30
 
 
To
01/02/2000 14:25:12
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00325732
Message ID:
00325761
Views:
20
Yeah, I hear that. I was trying to keep it conceptually simple. What I have done in the past is scan through the value for FirstEditControl and activate any containers in the heirarchy. Another way to do it would be to have a FirstEditContainer property and, if that's not blank, Activate whatever it contains after an EVAL() or macro.



>>
>>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
>
>My framework does almost exactly this, but I ran into a thing or two after implementing it that I had to code for- specifically, if the edited control lives on a page in a pageframe, you'll want to activate that page too:
>
>
>	IF !EMPTY(THIS.FirstEditField)
>		oFirstControl = EVAL(THIS.FirstEditField)
>		IF TYPE("oFirstControl.Name") = "C"
>			IF UPPER(oFirstControl.Parent.BaseClass) = "PAGE"
>				lnPageOrder = oFirstControl.Parent.PageOrder
>				oFirstControl.Parent.Parent.ActivePage = lnPageOrder
>			ENDIF
>			oFirstControl.SetFocus()
>		ENDIF
>	ENDIF
>
>
>good tip.
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05
Previous
Reply
Map
View

Click here to load this message in the networking platform