cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
jthi
Super User

Table Box with multiline cells

Just noticed slight problem (one more to the long list of problems) with Table Box. I'm trying to add fairly long string to Table Box and because Table Box doesn't really support multiple lines I tried using Col Box with Table Box(<< Set Wrap())... issue with this is that it seems to break everything else

Names Default To Here(1);

tb = Table Box(
	nceb = Number Col Edit Box("Order", []),
	scb1 = String Col Box("103width", {}),
	cb = Col Box("longstring", {}),
	scb2 = String Col Box("104width", {}),
);

nceb << Set Width(40);
scb1 << Set Width(103);
scb2 << Set Width(104);

New window("",
	tb
);

textb = Text Box("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADDD", << Set Wrap(150));
long_str = "speciallylongname";

Eval(EvalExpr(
	tb << Add Row({1, Expr(long_str), Expr(textb), Expr(long_str)});
));

jthi_0-1658384249564.png

Seems like 103width is being wrapped and only second line is being show.

 

Does anyone have any good ideas how I could handle this? These three come to my mind quickly:

  1. Do I have to only use Col Boxes with Text Boxes and just accept that I can't let users select rows in Table Box as easily as I would like to?
  2. Do I have to write my custom class for new display box element (as in give up with Table Boxes)
  3. Create hidden columns with full text and then calculate max width I can show in String Col Boxes and only show those.
-Jarmo
4 REPLIES 4
txnelson
Super User

Re: Table Box with multiline cells

I ran your script and got different results.

txnelson_0-1658394407840.png

and even more confusing results by adding a second line to the table

txnelson_1-1658394486357.png

Using Col Box() with embedded Text Boxes seems to help

txnelson_2-1658394786367.png

 

 

Jim
jthi
Super User

Re: Table Box with multiline cells

@txnelson Differences in the first case could be caused by different font settings (or maybe even zoom levels?) as the widths are set by using pixels to my understanding. 

Second case is a bit worrying, as it looks like that rows are getting mixed up somehow. Most likely getting text from wrong row:

jthi_0-1658396308201.png

 (changed long_str = "11231231312312312312"; for second row).

 

Using Col Box with textboxes might be the "only" solution for now. Too bad you can't click and highlight rows with just setting tb << Set Selectable Rows(1); when using col boxes.

-Jarmo
jthi
Super User

Re: Table Box with multiline cells

Also because Table Box seems to have fixed height for each row, it might be beneficial to wrap Text Box() with Scroll Box() (this will make the column a bit wider if scroll box appears)

Names Default To Here(1);

tb = Table Box(
	nceb = Number Col Edit Box("Order", []),
	scb1 = String Col Box("103width", {}),
	cb = Col Box("longstring", {}),
	scb2 = String Col Box("104width", {}),
);

nceb << Set Width(40);
scb1 << Set Width(103);
scb2 << Set Width(104);

New window("",
	tb
);

textb = Scroll Box(Size(175, 35), 
	Text Box("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", << Set Wrap(150))
	, <<Set Auto Stretching(0, 0)
	, << Set Show Empty(0, 0)
);Eval(EvalExpr(
	tb << Add Row({1, Expr(long_str), Expr(textb), Expr(long_str)});
));

textb = Scroll Box(Size(175, 35), 
	Text Box("AAAA", << Set Wrap(150))
	, <<Set Auto Stretching(0, 0)
	, << Set Show Empty(0, 0)
);Eval(EvalExpr(
	tb << Add Row({1, Expr(long_str), Expr(textb), Expr(long_str)});
));

textb = Scroll Box(Size(175, 35), 
	Text Box("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", << Set Wrap(150))
	, <<Set Auto Stretching(0, 0)
	, << Set Show Empty(0, 0)
);
Eval(EvalExpr(
	tb << Add Row({1, Expr(long_str), Expr(textb), Expr(long_str)});
));
-Jarmo
David_Burnham
Super User (Alumni)

Re: Table Box with multiline cells

I tend to populate table boxes column-wise so I tried this:

 

nceb << set({1});
scb1 << set({long_str});
scb2 << set({long_str});
wait(2);
cb << set(lstBoxes);

But the same problem occurred.  The only way I could get it to work was to also have scb1 and a Col Box containing Text Boxes.  I've typically resorted to making the first column of a table box contain Radio Buttons to allow selections:

 

David_Burnham_0-1658443153428.png

 

-Dave