Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid valid does not fire
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01396480
Message ID:
01398372
Views:
78
For example, if you have grid.textbox with character controlsource:
Textbox.Gotfocus event
This.Tag=This.Value
Textbox.Lostfocus event
If Alltrim(This.Value)==Alltrim(This.Tag)
  Return
Endif
*** validation code here
>Ed
>What kind of trigger, my brain cells aren't focusing.
>
>>>Naomi
>>>In the Valid or LostFocus the first statement is to verify that a close or cancel button has not been clicked.
>>>
>>>LOCAL oLoc,lsValue,llAct,llOK,lsMsg
>>>STORE "" TO lsValue,lsMsg
>>>STORE .T. TO llAct,llOK
>>>* get the location of the Cancel & Close button (cmdDelete & cmdClose) 
>>>* get reference to object under mouse pointer
>>>oLoc = sys(1270)
>>>if vartype(oLoc)="L"
>>>	oLoc = This
>>>endif
>>>IF !INLIST(lower(oLoc.name),"cmdUpdate","cmddelete","cmdedit","cmdadd","cmdclose")
>>>
>>>
>>>I believe it "finally" dawned on me that there was an issue with that code. if the mouse pointer is left on the add or edit button after either are clicked, the Valid or LostFocus code does not run, "by design"...crap! I have had issues like this (valid code not running), intermittently for a while. Who knows why the light-bulb just turned on! It helps to have the coverage profiler turned on.
>>>
>>>When I removed the above reference to "cmdedit, cmdadd" the code works.
>>>
>>>Is there a better way to keep the valid from running when closing the form or canceling a process?
>>>
>>If you use LostFocus then simple trigger will ensure that code will fire just in case textbox.value has been changed by user; at this point, if needed, you may still disallow to close the form.
Edward Pikman
Independent Consultant
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform