BookmarkSubscribeRSS Feed
Choose Language Hide Translation Bar
samir

Community Trekker

Joined:

May 20, 2016

How to color a GUI background and buttons

Hello,

I am trying to find a way to change the look of my GUI...I noticed the standard background color of GUIs in JMP is GREY which is quite monocromatic...

How can I change  

  • The background color of the GUI
  • The background color of the buttons in the GUI
  • Insert a picture or logo in the GUI
  • ...

Curious to see how this can be done :)

Thanks.

7 REPLIES 7
ian_jmp

Staff

Joined:

Jun 23, 2011

Re: How to color a GUI background and buttons

This might get you started:

NamesDefaultToHere(1);

nw = NewWindow("W", 
		vlb = VListBox(
			bb = ButtonBox("Press Me"),
			sb = SpacerBox(Size(10, 100))
			);
		);

Wait(2);
vlb << backgroundColor("Blue");
Wait(2);
bb << backgroundColor("Red");
Wait(2);
bb << setIcon("$SAMPLE_IMAGES/pi.gif");
bb << setIconLocation("Left");

You need to look in 'Help > Scripting Index' to see the different display boxes and the messages they respond to (but if you have written a GUI you will be somewhat familiar with this anyway). For images, search for 'PictureBox()'.

markbailey

Staff

Joined:

Jun 23, 2011

Re: How to color a GUI background and buttons

The << Background Color() message does not have an effect on the button box.

Learn it once, use it forever!
txnelson

Super User

Joined:

Jun 22, 2012

Re: How to color a GUI background and buttons

The only way that I see that you could color the background of a Button Box() is to create and image of the color background, and overlayed text, and then to specify it to the Button Box() as what to display.  Below is a script using a builtin Icon, but the Set Icon() message can also point to an imate

Names Default To Here( 1 );
New Window( "Example", ex = Button Box( "" ) );
ex << Set Icon( "Go" );
Jim
ms

Super User

Joined:

Jun 23, 2011

Re: How to color a GUI background and buttons

Try different settings in Preferences/Styles to globally add some color to the GUI.

samir

Community Trekker

Joined:

May 20, 2016

Re: How to color a GUI background and buttons

Hello @ian_jmp, @txnelson, @markbailey, @ms,

So far I was not able to change the color of the:

  1. Buttons background
  2. GUI-window background

I guess these options do not exist in JMP :(

ian_jmp

Staff

Joined:

Jun 23, 2011

Re: How to color a GUI background and buttons

Regarding the buttons, you can use Jim's approach:

Names Default To Here( 1 );
New Window( "Example", ex = Button Box( "", Beep() ) );
ex << Set Icon( "$DESKTOP/Screen Shot 2017-11-21 at 15.27.12.png" );

where I made the .png file by tacking a screenshot from a drawing package. This gives:

Screen Shot 2017-11-21 at 15.29.25.png

samir

Community Trekker

Joined:

May 20, 2016

Re: How to color a GUI background and buttons

Strange,

What I get by running the code is (I also placed a .png picture where it should be):

Capture.PNG

I am using JMP11. Could this be the problem ?