cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
NRW
NRW
Level IV

How to construct a "Variable" V List (or H List)

Folks,

 

I use the following expression to populate a PowerPoint slide. Usually it's three rows lined vertically. However, I was looking for a more elegant way to set up a conditional statement to make the items in the V List variable. That is sometimes I will want only one row vs. three. Or maybe more than three rows. I put a commented "If" statement just to visualize what I'm after (obviously this does not work).  

 

Ultimately looking for a more flexible way to arrange not only V List, but H List as well.

 

Many Thanks

 

Neil

 

coltwin_1 = Expr( 								// Layout for surface orientation					
					V List Box(
						H List Box(
							sem1,
							col1 ,
							LT1 ,
							spacer box(size(50,0))	
						),
					//If (n > 1,
							sp1 = Spacer Box( size(0, 100)),
							H List Box(
								sem2,
								col2,
								LT2,
							),
							sp2 = Spacer Box( size(0, 100)),
							H List Box(
								sem3,
								col3,
								LT3
							)
					//);				
				));
Neil
1 ACCEPTED SOLUTION

Accepted Solutions
ian_jmp
Staff

Re: How to construct a "Variable" V List (or H List)

Everyone develops their own style, and here's one:

NamesDefaultToHere(1);

tb = TextBox( "Hello world" );

n1 = 3;
vlb1 = VListBox();
for(i=1, i<=n1, i++, InsertInto(vlb1, tb));
NewWindow(Char(n1)|| " display boxes in a Vertical List Box", vlb1);

n2 = 5;
vlb2 = VListBox();
for(i=1, i<=n2, i++, InsertInto(vlb2, tb));
NewWindow(Char(n2)|| " display boxes in a Vertical List Box", vlb2);

You might also look at 'LineUpBox()'.

View solution in original post

3 REPLIES 3
ian_jmp
Staff

Re: How to construct a "Variable" V List (or H List)

Everyone develops their own style, and here's one:

NamesDefaultToHere(1);

tb = TextBox( "Hello world" );

n1 = 3;
vlb1 = VListBox();
for(i=1, i<=n1, i++, InsertInto(vlb1, tb));
NewWindow(Char(n1)|| " display boxes in a Vertical List Box", vlb1);

n2 = 5;
vlb2 = VListBox();
for(i=1, i<=n2, i++, InsertInto(vlb2, tb));
NewWindow(Char(n2)|| " display boxes in a Vertical List Box", vlb2);

You might also look at 'LineUpBox()'.

NRW
NRW
Level IV

Re: How to construct a "Variable" V List (or H List)

Many thanks for reply and input. I'm working on overhauling my clumsy approach and introducing what you have suggested. I included "commented" old approach to illustrate what was working in static mode. I've got image file sets with "a1", "a2", and "a3" suffixes. However, I'm still getting one row (H list) that is displayed and it is the "a3" set. Index did ratchet 1-3, but final image set was the last read. As if a1 and a2 sets were overwritten.

 

Thanks in advance for all your help.

 

 

For(i=1, i<=n, i++,
		
			sem = Open(SD1 || samplename2 || "_a" || Char(i) || ".jpg", jpg);
			sem << Scale(.15);
			col = Open(SD1 || samplename2 || "_a" || Char(i) || "_16col_filt.jpg", jpg);
			col << Scale(.16);
			LT = Open(SD1 || samplename2 || "_a" || Char(i) || "_LtIm.jpg", jpg);
			LT << Scale(.16);
			
			coltwin_1 = V List Box();
			H_list = H List Box(sem, col, LT, spacer box(size(50,0)));
			InsertInto(coltwin_1, H_list);
			
		);
		
		
		//sem1 = Open(SD1 || samplename2 || "_a1.jpg", jpg);
		//sem1 << Scale(.15);
		//col1 = Open(SD1 || samplename2 || "_a1_16col_filt.jpg", jpg);
		//col1 << Scale(.16);
		//LT1 = Open(SD1 || samplename2 || "_a1_LtIm.jpg", jpg);
		//LT1 << Scale(.16);
		//sem2 = Open(SD1 || samplename2 || "_a2.jpg", jpg);
		//sem2 << Scale(.15);
		//sem3 = Open(SD1 || samplename2 || "_a3.jpg", jpg);
		//sem3 << Scale(.15);
		//col2 = Open(SD1 || samplename2 || "_a2_16col_filt.jpg", jpg);
		//col2 << Scale(.16);
		//col3 = Open(SD1 || samplename2 || "_a3_16col_filt.jpg", jpg);
		//col3 << Scale(.16);
		//LT2 = Open(SD1 || samplename2 || "_a2_LtIm.jpg", jpg);
		//LT2 << Scale(.16);
		//LT3 = Open(SD1 || samplename2 || "_a3_LtIm.jpg", jpg);
		//LT3 << Scale(.16);	

/*coltwin_1 = Expr( 													
					V List Box(
						H List Box(
							sem1,
							col1 ,
							LT1 ,
							spacer box(size(50,0))	
						),
					
						sp1 = Spacer Box( size(0, 100)),
						H List Box(
							sem2,
							col2,
							LT2,
						),
						sp2 = Spacer Box( size(0, 100)),
						H List Box(
							sem3,
							col3,
							LT3
						)
							
				));*/
Neil
NRW
NRW
Level IV

Re: How to construct a "Variable" V List (or H List)

Immediately saw my mistake as soon as I sent the reply:)

 

This works perfectly, much more elegant!

Thank you again for all the help. 

 

coltwin_1 = V List Box();
		For(i=1, i<=n, i++,
		
			s = Open(SD1 || samplename2 || "_a" || Char(i) || ".jpg", jpg);
			s << Scale(.15);
			col = Open(SD1 || samplename2 || "_a" || Char(i) || "_filt.jpg", jpg);
			col << Scale(.16);
			LT = Open(SD1 || samplename2 || "_a" || Char(i) || "_L.jpg", jpg);
			LT << Scale(.16);
			
			H_list = H List Box(s, col, LT, spacer box(size(50,0)));
			
			InsertInto(coltwin_1, H_list);
			InsertInto(coltwin_1, sp = Spacer Box( size(0, 100)));
		);
Neil