Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Textbox VALID not firing?
Message
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00341975
Message ID:
00343082
Views:
23
>Ed,
>
>>>AFAIK you can not prevent selecting other objects with the mouse.
>>>Th workaround could be have a code in the other controls GotFocus and When event, but this is tough...
>>>I hope, somebody else may advise a better approach.
>>>
>>
>>How about the trivial solution of:
>>
>>Create a custom form method that evaluates the value of the textbox, and sets the Enabled property of the other controls according to the value of the textbox? You can't click into it if it's not enabled....
>>
>>Call the method in Form.Activate(), and in the Valid() of the textbox control. This is an isomorph of a solution discussed in another thread I addressed earlier this evening about selective enable/disable of controls.
>
> Yes, I saw this thread. This is a good solution.
>
> My point actually was, that even if the control TabOrder is 1 on the form and this control has something in Valid method, we still can leave this control and go to another with mouse. Right now, however, I'm not so sure in this statement, so I need to make additional testing. At least, I noticed this behavior in some of my classes...

Ok, I checked this class and found, that code was in KeyPress method, not in Valid. I tried to put this code in Valid instead, spent ~1,5 h. trying to achieve my goal and finally had to return the code into KeyPress method.

Anyway, if the control has code in Valid method and it returns .f. or number different from 1, we can not leave this control, using KeyBoard or mouse.

Somehow my class gave me wrong illusion before, but now I corrected myself.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform