Normal Topic Changing button display based on Mode (Read 416 times)
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Changing button display based on Mode
Sep 5th, 2007 at 6:16pm
Print Post Print Post  
I'm trying to set the label and color of a command button based on what mode the system is in.  the default of the button is bright yellow with no label.  I have the following in On-Form-Entry:
Code
Select All
// Changes the colors and functions of the GO Button depending on the mode

// Add Mode

IF @Mode() = 0
	{
	Label(GO_Button, "Get It!")
	RGBColor(GO_Button, 0, 0, 0, 226, 145, 145)	// Black text on Pinkish
	}
ELSE

// Search Mode

IF @Mode() = 2
	{
	Label(GO_Button, "Get It!")
	RGBColor(GO_Button, 0, 0, 0, 179, 255, 255)    // Black text on light Blue
	}

ELSE

// Update Mode

IF @Mode() = 1
	{
	Label(GO_Button, "New Search")
	RGBColor(GO_Button, 0, 0, 0, 255, 255, 0)    //Black text on bright Yellow
	} 


This works perfectly in Add mode.  However, in Search and Update, all I see is the default button, no text on bright yellow.  What am I missing?
  

**
Captain Infinity
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Changing button display based on Mode
Reply #1 - Sep 5th, 2007 at 6:45pm
Print Post Print Post  
Hello Scott,

@Mode will never equal 2 in the On Form Entry event. The On Form Entry event runs when arriving at a record. Since @Mode() 2 is Search mode, On Form Entry will not run. You will want to use the On Retrieve Spec open event for the code in the @Mode() = 2 condition.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
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: Changing button display based on Mode
Reply #2 - Sep 5th, 2007 at 7:08pm
Print Post Print Post  
Super, thanks Ray!
  

**
Captain Infinity
Back to top
IP Logged