del
New Member
Posts: 12
|
Post by del on Jun 21, 2021 7:36:02 GMT -5
I have a list of items I wish to display in a "Text Window" in two aligned columns. ( Open "List" for text as #win2) I am able to print the list in two columns but I'm unable to get the the second column text to aligned in due to the varying number of characters per item. The Tab Command only appears to work with Mainwin and Lprint, not in a text box or a text window. I've tried to add enough spaces to make each item the same lengths but that doesn't work either. Print #win2, ListArray$(n,1);space$(padding); ListArray$(n+1,1) Attachments:
|
|
|
Post by Walt Decker on Jun 21, 2021 8:24:41 GMT -5
1 - Change the font to a fixed font, e. g. Courier new 2 - Parse the file to find the longest string for the first column 3 - Pad the first column with spaces to the length of the longest string plus enough to separate the first column from the second.
|
|
|
Post by tsh73 on Jun 21, 2021 8:50:03 GMT -5
It looks like one could indeed use TAB character for aligning, but in a textbox nomainwin
WindowWidth = 550 WindowHeight = 410
UpperLeftX=int((DisplayWidth-WindowWidth)/2) UpperLeftY=int((DisplayHeight-WindowHeight)/2)
textbox #main.textbox1, 26, 16, 328, 300 open "untitled" for window as #main print #main, "trapclose [quit.main]"
print #main, "font ms_sans_serif 10"
tb$=chr$(9) crlf$=chr$(13)+chr$(10) #main.textbox1 "Old "+tb$+"McDonald" +crlf$+_ "had "+tb$+"a farm" +crlf$+_ "Ye-haa "+tb$+"ye-haa ooo"
wait
[quit.main] Close #main END
|
|
del
New Member
Posts: 12
|
Post by del on Jun 21, 2021 10:53:57 GMT -5
Thanks guys for resolving my problem. I chose a text window over a textbox because of its built in menu with print. I've taken Walt's solution and changed a single line in my original code to make it work. Was #win2, "!font arial 14 italic" now reads #win2, "!font Courier new 16 italic bold". So simple when you know how! Thanks.
|
|
del
New Member
Posts: 12
|
Post by del on Jun 21, 2021 10:57:40 GMT -5
Not keen on Courier, so I'll look for a fixed font I like
|
|
|
Post by alincon on Jun 21, 2021 19:18:47 GMT -5
My current favorite fixed-width font is consolas.
r.m.
|
|
del
New Member
Posts: 12
|
Post by del on Jun 22, 2021 5:37:21 GMT -5
Thanks,consolas Bold stands out very nicely.
|
|