Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Textbox VALID not firing?
Message
From
08/03/2000 23:38:49
Jill Derickson
Software Specialties
Saipan, CNMI
 
 
To
08/03/2000 18:17:31
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00341975
Message ID:
00343565
Views:
17
Thanks for your suggestions...no, the controls are not on a pageframe.

The problem was the LASTKEY() test...the user (ME!) had pressed the ESCAPE key in a previous form, but the key was never cleared, so in the newly initted form, the VALID catches the ESCAPE key and returns...I guess since the system already dealt w/the ESCAPE key, the current form's CANCEL button (w/CANCEL = .T.) was not invoked. Now tht I think about it, I'm not sure why it works quite THAT way, but I added the following to the INIT of this form and it solves the problem:

IF LastKey() = AscEsc
KEYBOARD CHR(255) && clear the escape
=INKEY() && eat the character we just keyboarded
ENDIF

J

>I'm guessing here, but are your controls on a pageframe ? I seem to remember this being an issue, if so, the workaround is to cover each page with an object so that the page can never recieve focus.
>
>HTH
>
>Des
>
>>I have a textbox, whose value is initialized to 0, with the following in the VALID:
>>
>>
 IF LASTKEY() = AscEsc
>>  RETURN
>>ENDIF
>>
>>lOK = .T.
>>** check for legal values; set nRecsNeeded
>>DO CASE
>> CASE This.Value <= 0
>>    WAIT WINDOW "Group size must be greater than zero"
>>    RETURN .F.
>>
>>
>>...followed by other cases in the CASE statement.
>>
>>According to the tab order, the text box is the first control in the form, and it IS selected when the form starts.
>>
>>I don't want to let focus out of the text box until the user inputs a non-zero value. At times, once the form is diaplayed, and the user user clicks on a combo box on the form, the valid does not fire, i.e., the focus leaves the textbox and goes to the combo box. [If the user presses the TAB or ENTER key with the intial zero value, the appropriate error message is displayed.]
>>
>>I'm missing something...how can I keep focus on the text box until the user has entered a legal value? Any input is appreciated. J
Previous
Reply
Map
View

Click here to load this message in the networking platform