Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SetFocus
Message
From
02/01/1998 17:38:35
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00068704
Message ID:
00069024
Views:
48
>>Maybe I should explain my situation more clearly. I have a data entry screen and there are some fields that cannot be left blank. I put in the field properties at the database level this rule but this rule doesn't get enforced until I do a tableupdate(). I spoke with our data entry people and asked them if they liked this option and was told no. I then thought of keeping the field properties in place and add the rules on the front end also. So, If someone leaves a certain field blank and tried to tab out of it I want to display an error and not let them leave the field until something is entered. The setfocus() works if I call it from a different control. I tried calling it from the lostfocus method of the control I want to get focus but this doesn't, the next control just gets the focus. If anyone has any suggestions I would surely welcome them.
>>
>>Mark A. Struck
>Mark,
>
>You can RETURN 0 from the VALID of the textbox to force focus to stay in there. You would need to deal with the user trying to cancle the edit though. This can be done by making the Cancle proeprty of the Cancel button .T. and then in the valid of the textbox check for LASTKEY() being equal to 27 (the escape key), so the valid code might look like this;
>
> LOCAL lnReturn
> lnReturn = 1
> IF LASTKEY() = 27
> RETURN .T. && allow thing to progress
> ENDIF
> IF EMPTY(THIS.Value)
> lnReturn = 0
> ENDIF
> RETURN IIF(lnReturn=1,.T.,lnReturn)

Thanks Jim.
Previous
Reply
Map
View

Click here to load this message in the networking platform