newline in dialogs?

BlitzMax Forums/BlitzMax Programming/newline in dialogs?

Nigel Brown(Posted 2006) [#1]
Is there a way to format the text in a confirm dialog with newlines?


CS_TBL(Posted 2006) [#2]
add ~n in your text?


Nigel Brown(Posted 2006) [#3]
thank you CS_TBL, it only works when hard coded onto the code so I guess it compiles to something else. I am trying to include the string from a .inifile :-(


H&K(Posted 2006) [#4]
you might need ~~N


CS_TBL(Posted 2006) [#5]
Uhm, you want added newline commands in your text to prevent i getting too wide for the dialog? Is that what you want?

You need a custom parser for that, it has a given width-arguement and reformats the text including wordwrap and added newlines.

H&K: I think he means he doesn't want codes in his original text coming from the inifile..


Nigel Brown(Posted 2006) [#6]
CS_TBL, think you are correct I will need to write a parser for the imported text fields as the ~n works but only at compile time. I am importing strings from a .ini file to internationalize the application and the string "Disconnect UUT Then Connect next UUT" needs to be formatted as:

Disconnect UUT
Then
Connect next UUT

seems to be no obvious way to do this using escape characters?


TomToad(Posted 2006) [#7]
Just put ~n in the text file where you want the newline, but when you read in the string, just use replace() to replace them with real newlines.
Message = ReadLine(infile)
Message = Replace(Message,"~~n","~n")
etc...

You need "~~n" in the second paramter or else Replace will look for litteral newlines and not the "~n" sequence.


CS_TBL(Posted 2006) [#8]
NB: the point is: is the original text formatted? If so: look no further than this. Err.. partly then eh.. this is mainly to store a textfile in a blitz-string.


Picklesworth(Posted 2006) [#9]
We can assume that each line of text read with ReadLine is, in fact, a line, which means that the line after it is a new line. This means that after each time you read a line, there should be a newline character ;)
So could you read it like this?:

Message = Message + ReadLine(infile) + "~n"


Nigel Brown(Posted 2006) [#10]
thanks, I have decided to go with \n in the text file and the Message = Replace(message,"\n","~n") works very well! Thank you one and all.