Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Problem with multi-line edit box

michael_green
Beginner
386 Views
Hi,
I'm using a multi-line edit box in a dialog. I've checked the "want return" box. The edit box behaves exactly as I want it to when I enter text from the keyboard, that is, it wraps automatically at the end of a full line, or starts a new line when I press Enter.
However, I also need to load text into the edit box from a file, The text in the file has a well defined format as far as line lengths go and I'd like to preserve that when the text is loaded to the edit box. I have tried to do this by defining a string, reading each line from the file and concatenating the lines within the string but separated by carriage return characters. I have tried line feeds as well. I am then using SetDlgItemText to load the string to the edit box.
But it doesn't work. The edit box always displays the string using its full width before starting a new line, and ignoring all the intended new lines. Is there a way around this?
With many thanks in advance,
Mike
0 Kudos
1 Reply
Jugoslav_Dujic
Valued Contributor II
386 Views
You didn't seem to try the only thing that works -- CR and LF (char(13)//char(10))?
If all you need is to "dump" text file contents to the edit box or vice versa, the simplest approach is to open the file as BINARY, and read all of it in a huge string (e.g. allocatable character array), then send it to the edit control -- all CR/LF pairs will be preserved exactly where you need them.
Jugoslav
0 Kudos
Reply