Skip to main content
GameDev.net gamedev.net
🔒 Locked

edit box inserting return

Started by RedDragon0509 Oct 8, 2005 at 2:14 PM 2 replies 1.1k views
Original Post
RedDragon0509
RedDragon0509
I'm using a windows edit box and I want to set its text to what I read in from a file, but it does not insert the returns so everything is on one line. example: in the file: hello goodbye in the edit box: hellogoodbye also if I just try setting the text using: SendMessage(hWnd_edit, WM_SETTEXT, 0, (LPARAM)"hello\ngoodbye"); it does not take the \n to mean return(or at least insert one), but \t inserts a tab. the edit box is created using: hWnd_edit =CreateWindowEx(0, "EDIT", "edit", ES_MULTILINE | ES_AUTOVSCROLL,600, 0,400,400,0,NULL,hInstance,NULL); any ideas on how to insert a return?
When the world can't make you smile, program one that can
zoggo
zoggo
The Windows edit box ignores new lines on their own. You may need to insert a carraige return/line feed pair. Basically, you need to include a \r as well.

There are a few reasons why Windows may be jerking you around, but I have certainly come across this one before. It's the root cause as to why Notepad can't hack Linux or Mac formatted text files.
Colin Jeanne
Colin Jeanne
On Windows, the character sequence \r\n is a hard line break. So, change this string

"hello\ngoodbye"

to this

"hello\r\ngoodbye"
RedDragon0509
RedDragon0509
thank you,it works now
When the world can't make you smile, program one that can

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.