cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
A_Zaid
Level III

Resizing Panel Box in JSL

Hi JMP Community,

 

I'm creating an add-in that generates a dashboard. The dashboard has a panel box with a list of options to chose from. The part of the code that specifies the panel box is shown below (I tried to make it as simple as possible by commenting lines irrelevant to the issue at hand). On running the code, the panel I get looks like this:

MicrosoftTeams-image.png

This is excessively wide and I want to have control over its size, but I couldn't figure out how. I have tried "<< Set Size( width, height )" ‏‎and "<< Frame Size( width, height )" and they didn't work, though I'm not sure if I used them correctly, or if they are the right messages to begin with. Could you please advise me?

 

Thank you in advance!

Ahmed

 

win = Platform(
	dt,
	H List Box(
		Panel Box( "Select option:",
			plist = List Box(
				points,
				max selected( 1 ),
				chosen = plist << get selected;
				if( chosen[1] != "",
					// Some simple code that runs if no option is selected.
				);
				// Some simple code that runs if option is selected.
				// Some simple code that runs if option is selected.
				// Some simple code that runs if option is selected.
				// Some simple code that runs if option is selected.
				// Some simple code that runs if option is selected.
				// Some simple code that runs if option is selected.
			)
		)
	)
);

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Resizing Panel Box in JSL

Resize content inside the panel box

plist << Set Width(50)

Full example:

 

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Reliability/TurbineEngineDesign1.jmp");
win = new window("", Platform(
	dt,
	H List Box(
		Panel Box( "Select option:",
			plist = List Box(
				{"single", "double", "triple"},
				max selected( 1 ),
				chosen = plist << get selected;
				if( chosen[1] != "",
					// Some simple code that runs if no option is selected.
				);
				// Some simple code that runs if option is selected.
				// Some simple code that runs if option is selected.
				// Some simple code that runs if option is selected.
				// Some simple code that runs if option is selected.
				// Some simple code that runs if option is selected.
				// Some simple code that runs if option is selected.
			)
		)
	)
));
wait(2);
plist << set width(50);

 

-Jarmo

View solution in original post

4 REPLIES 4
jthi
Super User

Re: Resizing Panel Box in JSL

Resize content inside the panel box

plist << Set Width(50)

Full example:

 

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Reliability/TurbineEngineDesign1.jmp");
win = new window("", Platform(
	dt,
	H List Box(
		Panel Box( "Select option:",
			plist = List Box(
				{"single", "double", "triple"},
				max selected( 1 ),
				chosen = plist << get selected;
				if( chosen[1] != "",
					// Some simple code that runs if no option is selected.
				);
				// Some simple code that runs if option is selected.
				// Some simple code that runs if option is selected.
				// Some simple code that runs if option is selected.
				// Some simple code that runs if option is selected.
				// Some simple code that runs if option is selected.
				// Some simple code that runs if option is selected.
			)
		)
	)
));
wait(2);
plist << set width(50);

 

-Jarmo
A_Zaid
Level III

Re: Resizing Panel Box in JSL

Thank you @jthi!

Just for the benefit of everyone else, the "plist << set width( x );" only worked for me when I added it to the "Initialize()" section of the Application code.

Though, as an extension to my initial question, if you look again at the picture of the "Select option:" box above, you'll notice that it is made up of an outer and an inner boxes. The solution you suggested controls the inner nicely, but only. While the outer one would stretch with the inner, it would not shrink with it past a certain point. I tried labelling "Panel Box();" and "H List Box();" to then apply "<< set width():" to them and to "win" in the same manner, but to no avail. Any suggestions would be appreciated.

Thanks again!

Ahmed
jthi
Super User

Re: Resizing Panel Box in JSL

Spacer Boxes can do some pretty nice things. Check out link below (especially parts 10 and 11 with Spacer Boxes):

 

 

Edit:

Also check out this great Discovery Summit presentation from 2019 A Structured Approach to Programming With JSL for Building Real World, Scalable Applications . Topic related to this starts at 22:00 minute mark but I suggest checking out the whole presentation.

-Jarmo
A_Zaid
Level III

Re: Resizing Panel Box in JSL

I just realised that how much the outer box can shrink with the inner one is limited by the title ("Select option:"): the smaller the title the further it can shrink with the inner box. Needless to say then that removing the title all together resolves the issue.

Thanks for your help and for the useful links, @jthi!