Subscribe Bookmark RSS Feed

How to Set Cell Height or Text Wrapping in a Table Box

vheber

Community Trekker

Joined:

Aug 15, 2016

I'm trying to display some information in a Table Box in a display window. The text in one cell is so long that it extends the column width but does not wrap the text to extend the cell height. Is there a way to change this in the script so that the cell is taller and not wider?

 

This is an example of my current script:

longstring = "In the loveliest town of all, where the houses were white and high \!Nand the elms trees were green and higher than the houses, where the front yards were \!Nwide and pleasant and the back yards were bushy and worth finding out about, \!Nwhere the streets sloped down to the stream and the stream flowed \!Nquietly under the bridge, where the lawns ended in orchards and the orchards ended \!Nin fields and the fields ended in pastures and the pastures climbed the hill and \!Ndisappeared over the top toward the wonderful wide sky, \!Nin this loveliest of all towns Stuart stopped to get a drink of sarsaparilla.";

string2 = "The End.";

nw = New Window( "Display",

tb = table box(

string_col1 = String Col Box( "MyString", {longstring}),

string_col2 = String Col Box( "Column2", {string2})

)

);

 

Display on One Line.JPG

I've tried Set Height, Set Width, and Set Min/Max Size, but haven't found a way to get the cell any taller than one line. Open to suggestions, thanks!

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Justin_Chilton

Joined:

Aug 27, 2015

Solution

String Col Box does not support multiple lines within a single row. However, you can use a Col Box and append Text Boxes for each row for columns that need to span multiple rows.

Here's an updated version of your example. Note that the only way to add display boxes to a Col Box is using Append. We expect to add more flexibility to this in a future release of JMP.

 

longstring = "In the loveliest town of all, where the houses were white and high and the elms trees were green and higher than the houses, where the front yards were wide and pleasant and the back yards were bushy and worth finding out about, where the streets sloped down to the stream and the stream flowed quietly under the bridge, where the lawns ended in orchards and the orchards ended in fields and the fields ended in pastures and the pastures climbed the hill and disappeared over the top toward the wonderful wide sky, in this loveliest of all towns Stuart stopped to get a drink of sarsaparilla.";
string2 = "The End.";
nw = New Window( "Display",
	tb = Table Box(
		col1 = Col Box( "MyString" ),
		col2 = String Col Box( "Column2", {string2} )
	)
);

col1 << append( Text Box( longstring , <<set wrap( 350 ) ) );

Here is the resulting window:

 

Capture.PNG

Justin
4 REPLIES
txnelson

Super User

Joined:

Jun 22, 2012

Here is the example from the Scripting Index

     Help==>Scripting Index==>Data Table==>Set Cell Height

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Set Cell Height( 20 );
Jim
txnelson

Super User

Joined:

Jun 22, 2012

Oops.....I read Data Table, not Table Box.....my error

Jim
Justin_Chilton

Joined:

Aug 27, 2015

Solution

String Col Box does not support multiple lines within a single row. However, you can use a Col Box and append Text Boxes for each row for columns that need to span multiple rows.

Here's an updated version of your example. Note that the only way to add display boxes to a Col Box is using Append. We expect to add more flexibility to this in a future release of JMP.

 

longstring = "In the loveliest town of all, where the houses were white and high and the elms trees were green and higher than the houses, where the front yards were wide and pleasant and the back yards were bushy and worth finding out about, where the streets sloped down to the stream and the stream flowed quietly under the bridge, where the lawns ended in orchards and the orchards ended in fields and the fields ended in pastures and the pastures climbed the hill and disappeared over the top toward the wonderful wide sky, in this loveliest of all towns Stuart stopped to get a drink of sarsaparilla.";
string2 = "The End.";
nw = New Window( "Display",
	tb = Table Box(
		col1 = Col Box( "MyString" ),
		col2 = String Col Box( "Column2", {string2} )
	)
);

col1 << append( Text Box( longstring , <<set wrap( 350 ) ) );

Here is the resulting window:

 

Capture.PNG

Justin
vheber

Community Trekker

Joined:

Aug 15, 2016

This did it! Thank you for the quick reply!