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
Atong
Level II

How could I build display boxes in modal window basing on radiobox selection

My code is like below, it works well if I click option 1 and 2 one by one, but multiple list box would be generated after I continuously click the option 1 which would make my users confused. How could I optimize the code? Many thanks.

 

Another two question are:

1. If I delete a panel box, would the boxed(like text box) be deleted too or just not displayed?

2. How could I get the hierarchy of a modal window?

 


dt = Current Data Table();

If( Is Empty( dt ),
	Stop(),
	nc = N Col( dt )
);



openDTs = {};
For( i = 1, i <= N Table(), i++,
	Insert Into( openDTs, Data Table( i ) << getname )
);

tableSelBox = Expr(
	//Panel Box( "Select Limit Table", 
	
	lbtableSel = List Box( openDTs, width( 150 ), nlines( 6 ), maxselected( 1 ), ), 
		
		
	//),

);

nw = New Window( "Auto Plot",
	modal,
	hb = H List Box(
		V List Box(
			Panel Box( "Mode Selection",
				Spacer Box( size( 100, 0 ) ),
				rbMethod = Radio Box(
					{"With Current Limit", "Without Current Limit"},
					rbSel = rbMethod << get selected;
					dbAfterpb = colSelLstBox << Next();				

					If( rbSel == "With Current Limit",
						pb << Sib Append( tableSelBox ),

					);
					
					If( rbSel == "Without Current Limit", 

						dbAfterpb << Delete;
						lbtableSel << Delete
					),

				),

			), 


			Panel Box( "Action",
				Spacer Box( size( 100, 0 ) ),
				okBb = Button Box( "OK", Stop() ), 
			
				cancelBb = Button Box( "Cancel", Stop() ),

			), 

		), 
		
		pb = Panel Box( "Select Columns",
			colSelLstBox = Filter Col Selector( dt, nlines( Min( nc, 13 ) ) ), 

		), 
		
		pb << Sib Append( tableSelBox ), 
		

	), 
		
);

 

Atong_0-1697702802743.png

 

 
4 ACCEPTED SOLUTIONS

Accepted Solutions
jthi
Super User

Re: How could I build display boxes in modal window basing on radiobox selection

What would you like the user to be able to do?

 

1. If you delete the Panel Box() objects inside should also be deleted (use << Delete Box on your panel box and try what returns you get from the old references inside it, they are something like DisplayBox[] instead of DisplayBox[FilterColSelector] for example).

2. Which hierarchy? If you wish to see the Tree Structure or Properties, removing modal temporarily is easiest option

-Jarmo

View solution in original post

Ressel
Level VI

Re: How could I build display boxes in modal window basing on radiobox selection

Maybe this is just me, but it would be a lot easier to understand your problem if you could share a table belonging to your script.

View solution in original post

Atong
Level II

Re: How could I build display boxes in modal window basing on radiobox selection

Sorry for making you confused. The problem I met is not related to certain table but a UI development question.

 

I mean that how to use radio box to generate display boxes, like when click option 1 is to generate a list box A, option 2 is to generate a list box B, option 3 do nothing. What's more, if I click option 1 and then click option 2, the list box A would be deleted and a new list box B would show up.

 

In my code, all things work well  if I click  option 1 --> option 2 --> option 1 --> option 2.... but if I click option1 multipe times, multiple list boxes would show up, this would make my user confused, below is the image shows that 4 list boxes are generated after I click 'option 1' 4 times.

 

Atong_1-1697719786763.png

 

View solution in original post

jthi
Super User

Re: How could I build display boxes in modal window basing on radiobox selection

You can maybe add additional check when With Current Limit is the option to check if lbtableSel is empty

If(rbSel == "With Current Limit" & is empty(lbtableSel),
-Jarmo

View solution in original post

6 REPLIES 6
jthi
Super User

Re: How could I build display boxes in modal window basing on radiobox selection

What would you like the user to be able to do?

 

1. If you delete the Panel Box() objects inside should also be deleted (use << Delete Box on your panel box and try what returns you get from the old references inside it, they are something like DisplayBox[] instead of DisplayBox[FilterColSelector] for example).

2. Which hierarchy? If you wish to see the Tree Structure or Properties, removing modal temporarily is easiest option

-Jarmo
Atong
Level II

Re: How could I build display boxes in modal window basing on radiobox selection

When I click option "With Current Limit",a new list box would show up at the right of panel "Select Columns", if I click option “Without Current Limit”, the list box would be deleted,  if I click option 1 --> option 2 --> option 1 --> option 2, it works well. But if I click option1 multipe times, multiple list boxes would show up, this would make my user confused, below is the image shows that 4 list boxes are generated after I click 'option 1' 4 times.

 

Atong_0-1697719296671.png

 

Ressel
Level VI

Re: How could I build display boxes in modal window basing on radiobox selection

Maybe this is just me, but it would be a lot easier to understand your problem if you could share a table belonging to your script.

Atong
Level II

Re: How could I build display boxes in modal window basing on radiobox selection

Sorry for making you confused. The problem I met is not related to certain table but a UI development question.

 

I mean that how to use radio box to generate display boxes, like when click option 1 is to generate a list box A, option 2 is to generate a list box B, option 3 do nothing. What's more, if I click option 1 and then click option 2, the list box A would be deleted and a new list box B would show up.

 

In my code, all things work well  if I click  option 1 --> option 2 --> option 1 --> option 2.... but if I click option1 multipe times, multiple list boxes would show up, this would make my user confused, below is the image shows that 4 list boxes are generated after I click 'option 1' 4 times.

 

Atong_1-1697719786763.png

 

jthi
Super User

Re: How could I build display boxes in modal window basing on radiobox selection

You can maybe add additional check when With Current Limit is the option to check if lbtableSel is empty

If(rbSel == "With Current Limit" & is empty(lbtableSel),
-Jarmo
Atong
Level II

Re: How could I build display boxes in modal window basing on radiobox selection

Thanks, your code works well in non-modal mode.

 

In modal mode, if I click option 1 --> option 2 -- > option 1, the list box will not show up, but when I tried additional option 2 --> option 1, it shows up! Basing on my investigation, I found seems there is a non visible List Box behind panel colSelLstBox, I can't call it and detele it, but after option 2 is operated 2 times, it will be finally deleted, so option 1 can work. So interesting....

 

My final solution in modal mode is to add a size(0,0) spacer box then I can get the handler of it, judge if it exist, delete or generate.