Normal Topic Where should "Visability" code go? (Read 475 times)
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Where should "Visability" code go?
Dec 6th, 2010 at 7:49pm
Print Post Print Post  
I have a static text element that says 'EMAIL NEEDED", which I want to appear when the text box element Email_Address is empty, but only in Add or Update mode.  In search mode and when the text box contains an address, I want it to be invisible.  I've told Programmer that the element (LE7) should have a starting visability of "false" (invisible).  I've made the following code...but I'm not sure where I should put it in the program:
Code
Select All
// Reveals the "EMAIL NEEDED" static text if the Primary Email box is empty
IF (@IsBlank(Email_Address) and (@Mode() = 0 or @Mode() = 1))
THEN
	{
	Visibility(LE7, 1)
	}
ELSE
	{
	Visibility(LE7, 0)
	}
ForceRedraw() 


I'm also not sure if the final ForceRedraw is necessary or working, I just grabbed it out of the manual example on page 431.

Help with this would be most appreciated.
  

**
Captain Infinity
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Where should "Visability" code go?
Reply #1 - Dec 6th, 2010 at 8:57pm
Print Post Print Post  
To get all the behaviors you want, you should call this in the On Retrieve Spec Open event of the Form, the On Form Entry event of the Form, and On Element Change event of the Email_Address element.

To avoid repeating code, make it a subroutine in Global Code, then just call it from the different places you need it to run.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: Where should "Visability" code go?
Reply #2 - Dec 6th, 2010 at 9:24pm
Print Post Print Post  
Fantastic, thanks Erika!
  

**
Captain Infinity
Back to top
IP Logged