DrawText and tabs

BlitzMax Forums/BlitzMax Beginners Area/DrawText and tabs

Arry(Posted 2006) [#1]
Hello,

First post, please be gentle! :-)

I've written some code that writes some variables to a text file, basically :

Line$[i]=Name$+Tab$+Score+Tab$+"Level "+Level

Where Tab$=Chr(9)

This writes perfectly, tabs and all, however when I read back the file with :

Repeat
ScoresDone=1
Line$[i]=ReadLine(fileread)
i=i+1
Until Eof(fileread)

Then display with a loop for each and the command:

DrawText(Line$[loopvariable]),x,y)

the tabs aren't included on screen. If I use the print command, they display on the output box as I see them if I open the text file?

I've searched the forums, but to no avail - how do I get tabs to display with the drawtext command?

Any help gratefully received!

Thanks.


BlackSp1der(Posted 2006) [#2]
hi, try with tab$="~t"


Arry(Posted 2006) [#3]
Thanks, but again, that writes to the text file perfectly, but does not display the tabs via DrawText when read in.


TomToad(Posted 2006) [#4]
This appears to be a bug. Even DrawText "This is an example~twith~ttabs",10,10 doesn't work. When using print, the space between "example" and "with" is greater than the spacing between "with" and "tabs."
Print "This is an example~twith~ttabs"
Print "0123456789012345678901234567890123456789"

This will display
This is an example      with  tabs
0123456789012345678901234567890123456789


Edit: The web page shows the spacing differently in the example, so I replaced the tabs with spaces so it is shown the same way as on BlitzMAX. There are 6 spaces between "example" and "with" and only 2 spaces between "with" and "tabs."


Dreamora(Posted 2006) [#5]
DrawText does not accept any kind of string formating signs like ~n and ~t. If you want something like that you must do the drawtext calls accordingly and split the string. (this goes for tab as for multi line)


BlackSp1der(Posted 2006) [#6]
TomToad, it's not a bug, maybe the tab space size is equal to 6. Every 6 positions is a tab marker.

This is an example      with  tabs
0123456789012345678901234567890123456789
x-----x-----x-----x-----x-----x-----x



Arry(Posted 2006) [#7]
Thanks all - I'll have a go at splitting the strings now...