Is there a way to format lines in a text field? I want to line up some columns in a text field as I put separate fields in them.
I tried doing it with setting tabs but that results in widely spaced columns. Is there any way to line up the columns or set column stops?
Thank you
formatting a text field
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
formatting a text field
Cyril Pruszko
https://sites.google.com/a/pgcps.org/livecode/
https://sites.google.com/a/setonhs.org/app-and-game-workshop/home
https://learntolivecode.com/
https://sites.google.com/a/pgcps.org/livecode/
https://sites.google.com/a/setonhs.org/app-and-game-workshop/home
https://learntolivecode.com/
Re: formatting a text field
Hi Newbie4,
to be honest, I don't have the slightest idea what your are trying to do!?
Fields in fields?
Best
Klaus
to be honest, I don't have the slightest idea what your are trying to do!?
Fields in fields?

Best
Klaus
Re: formatting a text field
I am sorry that I did not explain it very well. Maybe a example will help.
For instance, I want to print my address book which has a name, address, phone number, etc stored in an array. I would like to print a report with just the name and phone number and have it nicely lined up in columns.
Right now I am assembling the fields I want into an output field to print
e.g.
Then when the loop finishes, I will print the field "toPrint"
The names are different lengths so the phone numbers do not line up correctly. If I make the tab a large enough number to accomodate the longest name, the report is too spread out.
I could set a smaller tab and truncate the longer names to fit.
Is there a better way to do it?
Thanks
For instance, I want to print my address book which has a name, address, phone number, etc stored in an array. I would like to print a report with just the name and phone number and have it nicely lined up in columns.
Right now I am assembling the fields I want into an output field to print
e.g.
Code: Select all
repeat with ctr = 1 to 20
put pb[ctr]["last"] & ", " & pb[ctr]["first"] & tab & pb[ctr]["phone"] into field "toPrint"
end repeat
The names are different lengths so the phone numbers do not line up correctly. If I make the tab a large enough number to accomodate the longest name, the report is too spread out.
I could set a smaller tab and truncate the longer names to fit.
Is there a better way to do it?
Thanks
Cyril Pruszko
https://sites.google.com/a/pgcps.org/livecode/
https://sites.google.com/a/setonhs.org/app-and-game-workshop/home
https://learntolivecode.com/
https://sites.google.com/a/pgcps.org/livecode/
https://sites.google.com/a/setonhs.org/app-and-game-workshop/home
https://learntolivecode.com/
Re: formatting a text field
Take a look at the tabStops property to set the tabs on the fly..
Re: formatting a text field
That was exactly what I was looking for. It works great.
I also discovered vGrid to help in choosing values for the tabStops, (hard since it is in pixels, not chars)
and hGrid which makes its also more readable.
Thanks
I also discovered vGrid to help in choosing values for the tabStops, (hard since it is in pixels, not chars)
and hGrid which makes its also more readable.
Thanks