- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page