Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Edit Boxes

This topic is 5624 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a program which contains two edit boxes. The first edit box is a single line and the other is a multiline. When the user presses enter, the text entered in the single box is saved to a string. However, I can not figure out how to make it so that when enter is pressed, the text entered in the single line box appears in the multiline box, and then the next time enter is pressed the new text is entered into the second box a line down from the original text.

Share this post

Link to post
Share on other sites
Plain win32 calls or MFC?

I know little of MFC, but I can make some guesses with win32 code. I'm guessing that, if you append a newline character followed by the string you want to add, it'll appear as a new line.
One way to do this is to read the entire text of the textbox (with WM_GETTEXTLENGTH followed by WM_GETTEXT), append the newline character and your string, then use WM_SETTEXT to write it back to the textbox.
Another might be to get the length of the textbox (WM_GETTEXTLENGTH), set the selection range to the end of the textbox (EM_SETSEL), then use EM_REPLACESEL to append a newline and your string.

Hopefully these'll work out.

EDIT: I've tested them; it seems that two characters ("\r\n") are necessary to indicate a line break.

[edited by - Beer Hunter on July 26, 2003 6:09:59 AM]

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!