[REBOL] Re: Blocks of strings in text-lists.
From: carl:cybercraft at: 7-May-2002 19:12
On 07-May-02, Gregg Irwin wrote:
> Hi Jason,
>> How about this?
>> view layout [text-list data [["aaaaa" "^-bb"]["cc" "^-dd"]]]
> How do you suggest to set/align the TABS when there are long words?
> That can be a bit of work with proportional fonts. If you just count
> chars and spaces, it's not so bad. You just decide at what
> "position" the tabs should fall, subtract the length of the leading
> string, and pad accordingly. A "smart tab" feature would look at all
> the items in the list and find the longest one, using that as a
> You could think of it like padding with spaces, but tabs count for n
> spaces, instead of one.
First up, thanks to Anton for the suggestion to put tab-characters in
the string. (blush:) Is it you Gregg who says we tend to look for
the hard way to do things too often?
As to Jason's question, you use 'para to set the tabs to the positions
you want. (Just looked it up.) ie...
view layout [
text-list para [tabs: [20 40 110 150]] data [
["a" "^-b" "^-c" "^-d" "^-e"]
["1" "^-2" "^-3" "^-4" "^-5"]
As Gregg said, you'd need to measure the strings if you want to set
the tabs based on their lengths. See the recent "Proportional-spaced
fonts with accent marks" thread for a discussion on measuring the
pixel-length of strings.