newline in dialogs?
BlitzMax Forums/BlitzMax Programming/newline in dialogs?
| ||
Is there a way to format the text in a confirm dialog with newlines? |
| ||
add ~n in your text? |
| ||
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 :-( |
| ||
you might need ~~N |
| ||
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.. |
| ||
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? |
| ||
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. |
| ||
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. |
| ||
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" |
| ||
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. |