Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I set up a form so the "When Selected" embed fires only 1 time? 1

Status
Not open for further replies.

rleiman

Programmer
May 3, 2006
258
US
Hi Everyone,

I placed some code in the "When Selected" event of an entry field when I noticed this code fires 2 times.

Can you tell me what property to set so it fires only 1 time?

Thanks.
Emad
 
Hi Emad,

Simple. Define a local BYTE variable and set it to True in the When Selected embed. i.e.

AlreadySelected BYTE(0)

CASE EVENT()
OF EVENT:Selected
IF NOT AlreadySelected
...
AlreadySelected = True
END

Does it fire again when you press the OK button? If so, the reason for that is because an EVENT:Accepted is sent to ALL the controls for Validation purposes. To prevent code to execute during that phase which is called the ACCEPTALL phase, do the following :

IF NOT 0{PROP:AcceptAll}
...
END

Regards
 
Hi ShankarJ,

Yes it was happening on pressing OK.

I will try your code.

Thanks.

Truly,
Emad
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top