For Loop inside a tab box where each loop creates a different tab in the windowI'm attempting to loop through a variable list of tools (ChamberTool or Cham) to create a list. Then using that list I create a contour of the data by date where each chamber is a separate tab on a tab box window. I've done each of these things independently but my particular issue is creating a tab for each tool from this variable list. Maybe my approach is way off but here is my script.
First, here are the two bits of script I have that work. I hand wave over the scripting of the parts that I already know how to do and to keep this post more brief and not detract from my main problem statement.
ContourG = dt << Contour stuff here;
Graph = new window("Contours", tab box(
"Tab Name Here", (vlistbox(ContourG)),
));But when i try to run a for loop i am completely broken.
Cham = Associative Array(Column(dt_stacked, "Chamber") << Get Values) << Get Keys;Associative Array(Column(dt_stacked, "Chamber")<< Get Values)<<GET keys=""></GET>
Re: For Loop inside a tab box where each loop creates a different tab in the windowMy previous post was not completly hard wired. It showed both a hard coded method, and a method that would allow you to decide to add tabs whenever you needed to. But to make it more direct, here is a reworked script that uses a JSL list to determine the tabs that need to be added
Names Default To Here( 1 );
tabList = {"First", "Second", "Third", "Fourth"};
New Window( "Example", tb = Tab Box() );
For( i = 1, i <= N Items( tabList ), i++,
tb << Add(
tabList[i] || " Tab",
Button Box( "Press " || tabList[i] )
)
);Re: For Loop inside a tab box where each loop creates a different tab in the window@txnelson, my code was my attempt to create a loop, based on a variable list, to have each discrete item in the list be its own tab. The example you gave looks like a way to hard code a specific number of tabs but in my case the number of tabs would change. For example, if my dataset one day has 5 distinct entities in my list then my code should generate 5 tabs, one for each entity. But the next day my dataset might be 8 entities.
And an unrelated question, any ide how i can update my email address on my account? I realized that my account is tied to an address that I no longer have access to and I can't for the life of me figure out how to update it.
Re: For Loop inside a tab box where each loop creates a different tab in the windowThe syntax you are using to create the new tabs is not correct; Below is the example taken directly from the Scripting Index, on how to add a new tab. Infact, the example shows 2 ways to do that. Your code only generates one tab.
Names Default To Here( 1 );
New Window( "Example",
tb = Tab Box(
Tab Page Box(
"First Tab",
Tip( "First Tab Tooltip" ),
Button Box( "Press One" )
),
Tab Page Box(
"Second Tab",
Closeable( 1 ),
Button Box( "Press Two" )
),
Tab Page Box(
"Third Tab",
Icon( "Nominal" ),
Button Box( "Press Three" )
)
)
);
Wait( 1 );
tb << Add(
"Fourth Tab",
Button Box( "Press Four" )
);
Re: For Loop inside a tab box where each loop creates a different tab in the windowIs that possible dynamically create a 2nd layer of Tab Boxes, my data has multi-layers of data, thank you.
<SPAN class="token function">Names Default To Here</SPAN><SPAN class="token punctuation">(</SPAN> <SPAN class="token number">1</SPAN> <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN>
tabList <SPAN class="token operator">=</SPAN> <SPAN class="token punctuation">{</SPAN><SPAN class="token string">"First"</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token string">"Second"</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token string">"Third"</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token string">"Fourth"</SPAN><SPAN class="token punctuation">}</SPAN><SPAN class="token punctuation">;<BR /></SPAN>
<SPAN class="token function">New Window</SPAN><SPAN class="token punctuation">(</SPAN> <SPAN class="token string">"Example"</SPAN><SPAN class="token punctuation">,</SPAN> tb <SPAN class="token operator">=</SPAN> <SPAN class="token function">Tab Box</SPAN><SPAN class="token punctuation">(</SPAN><SPAN class="token punctuation">)</SPAN> <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN>
<SPAN class="token function">For</SPAN><SPAN class="token punctuation">(</SPAN> i <SPAN class="token operator">=</SPAN> <SPAN class="token number">1</SPAN><SPAN class="token punctuation">,</SPAN> i <SPAN class="token operator"><=</SPAN> <SPAN class="token function">N Items</SPAN><SPAN class="token punctuation">(</SPAN> tabList <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">,</SPAN> i<SPAN class="token operator">++</SPAN><SPAN class="token punctuation">,</SPAN>
tb <SPAN class="token operator"><</SPAN><SPAN class="token operator"><</SPAN><SPAN class="token messages"> Add</SPAN><SPAN class="token punctuation">(</SPAN>
tabList<SPAN class="token punctuation">[</SPAN>i<SPAN class="token punctuation">]</SPAN> <SPAN class="token operator">||</SPAN> <SPAN class="token string">" Tab"</SPAN><SPAN class="token punctuation">,<BR /></SPAN> //another layer of tabs goes here<BR />
<SPAN class="token function">Button Box</SPAN><SPAN class="token punctuation">(</SPAN> <SPAN class="token string">"Press "</SPAN> <SPAN class="token operator">||</SPAN> tabList<SPAN class="token punctuation">[</SPAN>i<SPAN class="token punctuation">]</SPAN> <SPAN class="token punctuation">)</SPAN>
<SPAN class="token punctuation">)</SPAN>
<SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN>
Re: For Loop dentro de un cuadro de pestaña donde cada loop crea una pestaña diferente en la ventanaSobre la base del ejemplo de Jim:
NamesDefaultToHere(1);
// Make two lists that will define the two-level hierarchical tab structure
nFirst = 4;
nSecondMax = 5;
tabListFirst = {}; // A List
tabListSecond = {}; // A list of lists
for(i=1, i<=nFirst, i++,
InsertInto(tabListFirst, "Tab "|| Char(i));
secondList = {};
for(ii=1, ii<=randomInteger(1, nSecondMax), ii++,
InsertInto(secondList, "Tab "|| Char(ii))
);
InsertInto(tabListSecond, evalList(List(secondList)));
);
// Use these lists to build the UI
tb = Tab Box();
For( i = 1, i <= N Items( tabListFirst ), i++,
tb2 = TabBox();
for(ii = 1, ii <= NItems(tabListSecond[i]), ii++,
tb2 << add(
tabListSecond[i][ii] || " Tab",
Button Box( "Press " || tabListSecond[i][ii] )
);
);
tb << Add(tabListFirst[i] || " Tab", tb2);
);
New Window( "Example", tb );Re: For Loop dentro de un cuadro de pestaña donde cada loop crea una pestaña diferente en la ventanaThank you, that is exactly what i am looking for, my data has 4 level, and number of tab on the next level is based on tab value from previous level..Re: For Loop dentro de un cuadro de pestaña donde cada loop crea una pestaña diferente en la ventana4 level tab box example:
Names Default To Here( 1 );
// Make multiple lists that will define the multi-level hierarchical tab structure
nFirst = 5;
nSecondMax = 5;
nThirdMax = 5;
nForthMax = 5;
tabListFirst = {}; // first lists
tabListSecond = {}; // second lists
tabListThird = {}; // third lists
tabListForth = {}; // forth lists
For( i = 1, i <= nFirst, i++, //first level
Insert Into( tabListFirst, " L1 Tab " || Char( i ) );
secondList = {};
For( ii = 1, ii <= nSecondMax, ii++, //second level
Insert Into( secondList, "L2 Tab " || Char( ii ) );
thirdList = {};
For( iii = 1, iii <= nThirdMax, iii++,//third level
Insert Into( thirdList, "L3 Tab " || Char( iii ) );
forthList = {};
For( iiii = 1, iiii <= nForthMax, iiii++,//forth level
Insert Into( forthList, "L4 Tab " || Char( iiii ) )
);
Insert Into( tabListForth, Eval List( List( forthList ) ) );
);
Insert Into( tabListThird, Eval List( List( ThirdList ) ) );
);
Insert Into( tabListSecond, Eval List( List( secondList ) ) );
);
/*
Show( tabListFirst );
Show( tabListSecond );
Show( tabListThird );
Show( tabListForth );
*/
// Use these lists to build the UI
tb = Tab Box(); //first level of Tab Box
For( i = 1, i <= N Items( tabListFirst ), i++,
tb2 = Tab Box(); //second level of Tab Box
For( ii = 1, ii <= N Items( tabListSecond[i] ), ii++,
tb3 = Tab Box(); //third level of Tab Box
For (iii = 1, iii <= NItems ( tabListThird[ii]), iii++,
tb4 = Tab Box();
For (iiii = 1, iiii <= NItems ( tabListForth[iii]), iiii++,
tb4 << Add( tabListForth[iii][iiii] || " Tab",
Text Box( tabListFirst[i] ||"->"|| tabListSecond[ii][iii] ||"->"|| tabListThird[ii][iii] ||"->"|| tabListForth[iii][iiii]) )
);
tb3 << Add(tabListThird[ii][iii] || " Tab", tb4);
);
tb2 << Add ( tabListSecond[i][ii] || " Tab", tb3);
);
tb << Add( tabListFirst[i] || " Tab", tb2 );
);
New Window( "Example", tb );
Re: For Loop dentro de un cuadro de pestaña donde cada loop crea una pestaña diferente en la ventana
-->
Text Box( tabListFirst[i] ||"->"|| tabListSecond[ii][iii] ||"->"|| tabListThird[ii][iii] ||"->"|| tabListForth[iii][iiii]) )
Text Box( tabListFirst[i] ||"->"|| tabListSecond[i][ii] ||"->"|| tabListThird[ii][iii] ||"->"|| tabListForth[iii][iiii]) )
actualización menor ......
Re: For Loop dentro de un cuadro de pestaña donde cada loop crea una pestaña diferente en la ventanaPor supuesto, hay muchas formas de diseñar una interfaz de usuario. Pero con una jerarquía de cuatro niveles, consideraría usar un filtro de datos local con la opción 'condicional':
// Conditional (hierarchical) local data filter
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
gb = dt << Graph Builder(
Size( 529, 563 ),
Show Control Panel( 0 ),
Show Legend( 0 ),
Variables( X( :weight ), Y( :height ) ),
Elements( Points( X, Y, Legend( 5 ) ) ),
Local Data Filter(
Conditional,
Add Filter(
columns( :sex, :age, :name ),
Display( :sex, Size( 149, 28 ), List Display ),
Display( :age, Size( 149, 84 ), List Display ),
Display( :name, Size( 149, 210 ), List Display )
)
)
);