cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Register to attend Discovery Summit 2025 Online: Early Users Edition, Sept. 24-25.
  • New JMP features coming to desktops everywhere this September. Sign up to learn more at jmp.com/launch.
Choose Language Hide Translation Bar
SDF1
Super User

JSL: How to change Button Box hover color

Hello JMP users and scripters,

 

  I was just curious if anyone knew whether or not the color of a button box (when hovering over it) can be customized -- either through File > Preferences, or through JSL with your own code. See the "OK" button box in the image below -- it changes to a light blue color when you hover over it. 

SDF1_0-1753203284878.png

 

I tried searching through the scripting guide PDF and Scripting Index, but couldn't find anything about the hover color of a button box. I know the background color can be changed, but that's not what I'm after.

 

After reading the Scripting Guide, it seems like it is only a preferences thing, but I couldn't find anything there either.

 

Thanks in advance for any suggestions!,

DS

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: JSL: How to change Button Box hover color

I don't think you can really change any coloring on the buttons. If you really need different coloring, you could script your own button (I would use JMP class for something like this) using Mouse box + Text Box and maybe some other display boxes for styling. 

Names Default To Here(1);

nw = New Window("Example",
	H List Box(
		btn = Button Box("Press Me"),
		Mouse Box(
			Border Box(
				Left(2), Right(2), Top(1), Bottom(1), 
				Sides(15), 
				<< Set Background Color("Light Gray"),
				tb = Text Box("Press Me")
			)
			, <<setTrackEnable(1)
			, <<settrack(
				Function({this, pos},
					(this << child) << Set Background Color(If(pos[1] >= 0, "Light Blue", "Light Gray"))
				)
			)
			, << SetClickEnable(1)
			, <<setClick(/* button-down, move, button-release handler */
				Function({this, clickpt, event}, 
					If(event == "Pressed",
						show(this, clickpt, event);
					);
				)
			)
		)
	)
);
-Jarmo

View solution in original post

5 REPLIES 5
jthi
Super User

Re: JSL: How to change Button Box hover color

I don't think you can really change any coloring on the buttons. If you really need different coloring, you could script your own button (I would use JMP class for something like this) using Mouse box + Text Box and maybe some other display boxes for styling. 

Names Default To Here(1);

nw = New Window("Example",
	H List Box(
		btn = Button Box("Press Me"),
		Mouse Box(
			Border Box(
				Left(2), Right(2), Top(1), Bottom(1), 
				Sides(15), 
				<< Set Background Color("Light Gray"),
				tb = Text Box("Press Me")
			)
			, <<setTrackEnable(1)
			, <<settrack(
				Function({this, pos},
					(this << child) << Set Background Color(If(pos[1] >= 0, "Light Blue", "Light Gray"))
				)
			)
			, << SetClickEnable(1)
			, <<setClick(/* button-down, move, button-release handler */
				Function({this, clickpt, event}, 
					If(event == "Pressed",
						show(this, clickpt, event);
					);
				)
			)
		)
	)
);
-Jarmo
SDF1
Super User

Re: JSL: How to change Button Box hover color

Hi @jthi ,

 

  Thanks for your reply and solution. Yeah, I suspected this was not going to be something that was particularly easy to change because it seems to be something built into JMP and not an option that can be changed.

 

  Anyway, your solution definitely works and does what I was after, but would be very challenging to implement in the code I'm working on. It's good to know that there is a work around in JSL.

 

Thanks!,

DS

Re: JSL: How to change Button Box hover color

The button colors are determined by your Windows operating system colors.  In this case, changing the accent color in Windows Settings would change the button color in JMP.

 

Brian Corcoran

JMP Development

SDF1
Super User

Re: JSL: How to change Button Box hover color

Hi @briancorcoran ,

 

  Thanks for the additional information. Is this something that could be changed to become a customizable feature in JMP? Just curious.

 

Thanks!,

DS

Re: JSL: How to change Button Box hover color

We usually don't want to go against the operating system button settings, because they provide accessibility functionality like High Contrast for those that have sight impairments.  However, you can always make a request at the JMP Wish List at https://community.jmp.com/t5/JMP-Wish-List/idb-p/jmp-wish-list .

 

Thanks,


Brian Corcoran (JMP)

Recommended Articles