Wednesday, 22 August 2012

Multicolumn text

Some times a text is too long to show in a single column, but if you need to display all the text on more than a column, you can achieve this task with the offset-to-caret function. let's see how:
This is the commented code:

Rebol []
temp: layout [mytext: text as-is system/license] ;this is not necessary if you want to impose your width
width: mytext/size/x ;now I know each column width (if you don't choose your own width)
temp2: size-text mytext ;now I know text size (pair!)
column2:   offset-to-caret mytext ((temp2 / 3 ) * 0x1) ;index of the beggining of the second column
column3:   offset-to-caret mytext ((temp2 * 2 / 3 ) * 0x1);index of the beginning of the third column

view layout [
  title center "Rebol license"
  text width as-is copy/part system/license column2
  text width as-is copy/part column2 column3
  text width as-is copy   column3


  1. I am not finding that "as-is" word in the documentation. What does that mean, or where do I read about it? Thank you.

    1. Hi,
      The words "as-is" or "wrap" set the comportament about line breaks.
      I suppose that you noted as usually VID removes line breaks from text (wrap), with "as-is" you preserve the text.
      Try to look for "text vid" on search box. Tomorrow I'll send more information.