Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What is the next filed?
Message
From
22/10/1997 12:41:48
 
 
To
22/10/1997 09:37:48
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00056004
Message ID:
00056068
Views:
28
>Hi everybody!
>
>Is there a way, to determine in a textbox valid routin, that which the next object is? I don't mean the "next" as in order, but the one, whose activation caused the valid routin to fire.
>
>The reason is, that sometimes I don't want to run the valid routin to go. E.g. when user push Exit button, Or Cancel button, when there is unnecesarry to validate the contents of the textbox. But How can I determine, which object on screen caused the valid routin to go?
>I thought, that the validation should make in the when event of all other objects, but it is unconvient.
>Any comment?
>
>TIA
>
>BB

Bela,
I also agree with what Edward said about moving valid to one place (e.g. cmdSave). However, there may be instances where you want to immediately validate an entry. In those cases, I usually do this.

For example, if it's a textbox, in the Valid event I put some code like this:

*--if no data, enable it to pass
IF EMPTY(THIS.Value)
RETURN
ENDIF
llretval = .T.
SELECT mytable
SET ORDER TO myorder
IF NOT SEEK(ALLTRIM(THIS.Value))
THIS.Value = "" &&if character field
llretval = .F.
ENDIF
RETURN(llretval)

For this approach to work, you must make sure to check in the Save routine that the value is not empty (if you don't want it to be) before saving to file which is simple to check. Above example is overly simplified but you should get some idea.

HTH
John.
It's "my" world. You're just living in it.
Previous
Reply
Map
View

Click here to load this message in the networking platform