Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
QueryUnload / Valid events
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
QueryUnload / Valid events
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01051626
Message ID:
01051626
Views:
57
Hi

I've found an slight difference in behaviour when returning .F. or 0 from a controls valid method when used in conjunction with the QueryUnload method of a form.

If I have a textbox control on a form and the textbox's valid method looks like this ;
IF EMPTY(THIS.VALUE)
   MESSAGEBOX('Cannot Be Empty')
   RETURN 0
ENDIF  
In My Forms QueryUnload method I place some code to make me aware that it's running..
MessageBox('QueryUnLoad Firing')
If I load my form, setting focus to this control but don't enter anything into it. Now if I click the cross in the top right hand corner of the screen the text box based validation fires and prevents the QueryUnload method from running.

This is fine.

However, If I place the same validation code in the Valid method of a text box in a grid, and attempt to do the same thing, ie break the rule and click the cross in the top right hand corner, I get a different result.

The text box in the grid validation method runs and displays my message but then the QueryUnload method runs and display my 'QueryUnload running' message and shuts my form down.

Is this difference in behaviour expected? if so what can I do to make them both work in the same way.

Ideally I want the focus to remain in the text box if the validation fires and prevent the form from shutting down.

Thanks, Bernard......
Next
Reply
Map
View

Click here to load this message in the networking platform