cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
pmroz
Super User

Indentation of COLBOX text

I'm using colboxes inside of a tablebox.  The colboxes contain a set of text boxes, which allows me to control the foreground and background color as well as bolding of the text.  The problem is that the text is too close to the left side of it's column.  Here's an example where the first column is a colbox containing icon boxes, the second a stringcolbox, and the third one a colbox containing textboxes:

 

colbox justification.png

I was able to move the icon boxes in the Status column over using << padding(left10)), but short of adding a leading space or two to the Sample Text column I don't know how to move it to the right a bit.  The Icon Name column is OK, as it's a stringcolbox.  Here's the code:

 

nw = new window("Test Col Box Justification",
	tb = table box(
		cb = col box("Status",
			i1 = icon box("Go"),
			i2 = icon box("DebuggerRunWithoutBreakpoints"),
			i3 = icon box("Locked"),
			i4 = icon box("WinRelaunchAnalysis"),
			i5 = icon box("Excluded"),
			i6 = icon box("SASTableMeta"),
			i7 = icon box("ColStack"),
			i8 = icon box("DataTableBox"),
			i9 = icon box("WinFileNewDT"),
			i10 = icon box("SASExportData"),
		),
		sb = string col box("Icon Name", {"Go", "DebuggerRunWithoutBreakpoints", 
			"Locked", "WinRelaunchAnalysis", "Excluded", "SASTableMeta", "ColStack", 
			"DataTableBox", "WinFileNewDT", "SASExportData"}),
		tcb = col box("Sample Text",
			t1 = text box("The"),
			t2 = text box("quick"),
			t3 = text box("red"),
			t4 = text box("fox"),
			t5 = text box("jumped"),
			t6 = text box("over"),
			t7 = text box("the"),
			t8 = text box("oak"),
			t9 = text box("brown"),
			t10 = text box("log"),
		),
	)
);

t1 << font color(51) << Set Font Style("Bold") << background color(73);
t3 << font color(51);
t9 << font color(54);
tb << set underline headings(1) << set column borders(1) << set row borders(1) << set shade alternate rows(1);
i1 << Padding( Left( 10 ));		i2 << Padding( Left( 10 ));
i3 << Padding( Left( 10 ));		i4 << Padding( Left( 10 ));
i5 << Padding( Left( 10 ));		i6 << Padding( Left( 10 ));
i7 << Padding( Left( 10 ));		i8 << Padding( Left( 10 ));
i9 << Padding( Left( 10 ));		i10 << Padding( Left( 10 ));
1 ACCEPTED SOLUTION

Accepted Solutions

Re: Indentation of COLBOX text

I would do this by putting a BorderBox around each of the Text Boxes. I have updated your example to use a function to generate the BorderBox containing a TextBox and has a left padding of 10.

borderedText = Function( {txt},
	Border Box( Left( 10 ), Text Box( txt ) )
);

nw = new window("Test Col Box Justification",
	tb = table box(
		cb = col box("Status",
			i1 = icon box("Go"),
			i2 = icon box("DebuggerRunWithoutBreakpoints"),
			i3 = icon box("Locked"),
			i4 = icon box("WinRelaunchAnalysis"),
			i5 = icon box("Excluded"),
			i6 = icon box("SASTableMeta"),
			i7 = icon box("ColStack"),
			i8 = icon box("DataTableBox"),
			i9 = icon box("WinFileNewDT"),
			i10 = icon box("SASExportData"),
		),
		sb = string col box("Icon Name", {"Go", "DebuggerRunWithoutBreakpoints", 
			"Locked", "WinRelaunchAnalysis", "Excluded", "SASTableMeta", "ColStack", 
			"DataTableBox", "WinFileNewDT", "SASExportData"}),
		tcb = col box("Sample Text",
			t1 = borderedText("The"),
			t2 = borderedText("quick"),
			t3 = borderedText("red"),
			t4 = borderedText("fox"),
			t5 = borderedText("jumped"),
			t6 = borderedText("over"),
			t7 = borderedText("the"),
			t8 = borderedText("oak"),
			t9 = borderedText("brown"),
			t10 = borderedText("log"),
		),
	)
);

t1 << background color(73);
t1[Text Box(1)] << font color(51) << Set Font Style("Bold");
t3[Text Box(1)] << font color(51);
t9[Text Box(1)] << font color(54);
tb << set underline headings(1) << set column borders(1) << set row borders(1) << set shade alternate rows(1);
i1 << Padding( Left( 10 ));		i2 << Padding( Left( 10 ));
i3 << Padding( Left( 10 ));		i4 << Padding( Left( 10 ));
i5 << Padding( Left( 10 ));		i6 << Padding( Left( 10 ));
i7 << Padding( Left( 10 ));		i8 << Padding( Left( 10 ));
i9 << Padding( Left( 10 ));		i10 << Padding( Left( 10 ));

 Capture.PNG

Edit:  Fixed a mistake in my code due to the t(n) variables now being a BorderBox.

Edit 2:  Made one more change to highlight the whole cell instead of just the TextBox.

Justin

View solution in original post

4 REPLIES 4

Re: Indentation of COLBOX text

I would do this by putting a BorderBox around each of the Text Boxes. I have updated your example to use a function to generate the BorderBox containing a TextBox and has a left padding of 10.

borderedText = Function( {txt},
	Border Box( Left( 10 ), Text Box( txt ) )
);

nw = new window("Test Col Box Justification",
	tb = table box(
		cb = col box("Status",
			i1 = icon box("Go"),
			i2 = icon box("DebuggerRunWithoutBreakpoints"),
			i3 = icon box("Locked"),
			i4 = icon box("WinRelaunchAnalysis"),
			i5 = icon box("Excluded"),
			i6 = icon box("SASTableMeta"),
			i7 = icon box("ColStack"),
			i8 = icon box("DataTableBox"),
			i9 = icon box("WinFileNewDT"),
			i10 = icon box("SASExportData"),
		),
		sb = string col box("Icon Name", {"Go", "DebuggerRunWithoutBreakpoints", 
			"Locked", "WinRelaunchAnalysis", "Excluded", "SASTableMeta", "ColStack", 
			"DataTableBox", "WinFileNewDT", "SASExportData"}),
		tcb = col box("Sample Text",
			t1 = borderedText("The"),
			t2 = borderedText("quick"),
			t3 = borderedText("red"),
			t4 = borderedText("fox"),
			t5 = borderedText("jumped"),
			t6 = borderedText("over"),
			t7 = borderedText("the"),
			t8 = borderedText("oak"),
			t9 = borderedText("brown"),
			t10 = borderedText("log"),
		),
	)
);

t1 << background color(73);
t1[Text Box(1)] << font color(51) << Set Font Style("Bold");
t3[Text Box(1)] << font color(51);
t9[Text Box(1)] << font color(54);
tb << set underline headings(1) << set column borders(1) << set row borders(1) << set shade alternate rows(1);
i1 << Padding( Left( 10 ));		i2 << Padding( Left( 10 ));
i3 << Padding( Left( 10 ));		i4 << Padding( Left( 10 ));
i5 << Padding( Left( 10 ));		i6 << Padding( Left( 10 ));
i7 << Padding( Left( 10 ));		i8 << Padding( Left( 10 ));
i9 << Padding( Left( 10 ));		i10 << Padding( Left( 10 ));

 Capture.PNG

Edit:  Fixed a mistake in my code due to the t(n) variables now being a BorderBox.

Edit 2:  Made one more change to highlight the whole cell instead of just the TextBox.

Justin

Re: Indentation of COLBOX text

One quick tip. You can apply the padding to all of the IconBoxes in the ColBox using XPath instead of keeping track of variables and sending the Padding variables to each one.

This does it all in one line:

(cb << Xpath( "//IconBox" )) << Padding( Left( 10 ) );
Justin
txnelson
Super User

Re: Indentation of COLBOX text

you can add an H List Box() and Spacer Box() in front of each Text Box() in the ColBox().  

spacer.PNG

 

nw = New Window( "Test Col Box Justification",
	tb = Table Box(
		cb = Col Box(
			"Status",
			i1 = Icon Box( "Go" ),
			i2 = Icon Box( "DebuggerRunWithoutBreakpoints" ),
			i3 = Icon Box( "Locked" ),
			i4 = Icon Box( "WinRelaunchAnalysis" ),
			i5 = Icon Box( "Excluded" ),
			i6 = Icon Box( "SASTableMeta" ),
			i7 = Icon Box( "ColStack" ),
			i8 = Icon Box( "DataTableBox" ),
			i9 = Icon Box( "WinFileNewDT" ),
			i10 = Icon Box( "SASExportData" ),

		), 
		
		sb = String Col Box( "Icon Name",
			{"Go", "DebuggerRunWithoutBreakpoints", "Locked", "WinRelaunchAnalysis", "Excluded",
			"SASTableMeta", "ColStack", "DataTableBox", "WinFileNewDT", "SASExportData"}
		),
		tcb = Col Box(
			"Sample Text",
			H List Box( Spacer Box( size( 5, 0 ) ), t1 = Text Box( "The" ) ),
			t2 = Text Box( "quick" ),
			t3 = Text Box( "red" ),
			t4 = Text Box( "fox" ),
			t5 = Text Box( "jumped" ),
			t6 = Text Box( "over" ),
			t7 = Text Box( "the" ),
			t8 = Text Box( "oak" ),
			t9 = Text Box( "brown" ),
			t10 = Text Box( "log" ),

		),

	)
);

t1 << font color( 51 ) << Set Font Style( "Bold" ) << background color( 73 );
t3 << font color( 51 );
t9 << font color( 54 );
tb << set underline headings( 1 ) << set column borders( 1 ) << set row borders( 1 ) <<
set shade alternate rows( 1 );
i1 << Padding( Left( 10 ) );
i2 << Padding( Left( 10 ) );
i3 << Padding( Left( 10 ) );
i4 << Padding( Left( 10 ) );
i5 << Padding( Left( 10 ) );
i6 << Padding( Left( 10 ) );
i7 << Padding( Left( 10 ) );
i8 << Padding( Left( 10 ) );
i9 << Padding( Left( 10 ) );
i10 << Padding( Left( 10 ) );
Jim
pmroz
Super User

Re: Indentation of COLBOX text

Thanks Justin and Jim. The border box solution is fairly clean.