Page 1 of 1

Multiline, word-wrapped text in table cell?

Posted: Fri Jul 19, 2013 11:22 pm
by acolburn
I am trying to learn to create, display, (and then print) a report. I can select a record from a database and send the record's text to a field in another stack. By sending the info tab delimited I can put grid lines around it (...thanks to runrev's online lessons :-)) Some of the displayed text, however, is pretty long. Displayed in a single line, it just scrolls past the edge of the card. I am wondering if it's possible for me to display these fields in multi-line, word-wrapped cells.

Here's the code from the preOpenCard handler of my report form/card. (Tab delimited text is sent to the card elsewhere.):

Code: Select all

 --To create the grid set the hGrid and vGrid properties of the lines of the field which make up the table.
   set the hGrid of line 2 to -2 of field "FieldNote" to true
   set the vGrid of line 2 to -2 of field "FieldNote" to true
   --first column narrower than second column
   set the tabWidths of line 2 to -2 of field "FieldNote" to 130,300,0
   --add some spacing between the text paragraphs and the table.
   set the spaceBelow of line 1 of field "FieldNote" to 10
   set the spaceAbove of line -1 of field "FieldNote" to 10
   --To add a border to the table as a whole we set the borderWidth of all the lines in 
   --the table. When in hGrid mode, borders of adjacent lines which have compatible 
   --properties are elided into a 1-pixel grid line.
   set the borderWidth of line 2 to -2 of field "FieldNote" to 2
Thanks! -- Al C.

Re: Multiline, word-wrapped text in table cell?

Posted: Sat Jul 20, 2013 12:02 am
by dunbarx
Hi.

I am sure I am misunderstanding.

What happens if you set the dontWrap of the field to "false"?

Craig Newman

EDIT:

Or are you having this problem with the width of a "cell" in a table field?

MORE EDITING. I see you are. I would say you can manage this. You know the formattedWidth of your longest tabbed item. You can loop through your text, and wherever any such item exceeds the tab stop width you have set, you break up that item into two or more lines. You will have to bump down the next line by inserting dummy lines so that you do not break your basic line order.

This will look a bit klunky, though. Is there another way to manage your data?