Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Remind me how, please?
Message
From
28/10/2008 11:30:42
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01357393
Message ID:
01357713
Views:
18
>>>Got a date range, and if the Beginning Date is empty, but the user puts a something in the End Date, I need to display an error message and put the focus back in the Beginning date.
>>>
>>>So, someone please remind me how to do that?
>>>
>>>Thanks
>>
>>It seems folks do not use Foxpro too often anymore.
>>Firstly, you should use txtEndDate.Lostfocus event. If you want trigger it just in case user actually typed something then flank the tag in both Gotfocus and Lostfocus event. Use Setfocus with Nodefault to return focus to the box.
>>
>>*** txtEndDate.Gotfocus
>>This.Tag=Dtos(This.Value)
>>*** txtEndDate.Lostfocus
>>If This.tag==Dtos(This.value)  && no entry
>>  Return
>>Endif
>>If Not Empty(This.Parent.txtBeginDate)  && no action
>>  Return
>>Endif
>>=Messagebox("My Message")
>>This.Parent.txtBeginDate.Setfocus
>>Nodefault
>>
>
>Checking for the Esc key would be nice, too, so the user doesn't get trapped in the field.

Esc key is not needed here, because focus gets moved to another box. In case of setting focus to itself, textbox.value should be restored by tag, so user may continue moving around the form without typing entry.
Edward Pikman
Independent Consultant
Previous
Reply
Map
View

Click here to load this message in the networking platform