Advertisement

Multiline Win32 Text Box

Started by March 30, 2000 06:34 PM
7 comments, last by vallis 24 years, 8 months ago
I have a multiline win32 text box, but I can't seem to get a new line on it from my code. At the moment, my code is like this: char Buffer[1024] = {0}; wsprintf((char*)&Buffer, "Line 1\nLine 2\nLine 3\nLine 4\n"); SetDlgItemText(hDlg, TEXT_BOX, Buffer); I just get a square symbol (it won't print on the message board) instead... I guess it's just something other than \n, but does anyone know what exactly? Edited by - vallis on 3/30/00 6:36:07 PM
Change the ''\n'' to a ''\r'' and that will probably fix it.

If not, then its beats the s**t out of me.



I guess this is where most people put a famous quote...
"Everything is funnier with monkey''s" - Unknown
--------------------------I guess this is where most people put a famous quote..."Everything is funnier with monkey''s" - Unknown
Advertisement
Nope - no difference unfortunately...nice try though

I''ve tried \n, \n\r and \r...

Anyone else know?
Hmm.. Well. Try this:

1. Run program.
2. Use the edit box and put "line1line2"
3. Get the text from the edit box.
4. Use debugger to see what the newline character stuff is.


I guess this is where most people put a famous quote...
"Everything is funnier with monkey''s" - Unknown
--------------------------I guess this is where most people put a famous quote..."Everything is funnier with monkey''s" - Unknown
Cool idea...i''ll try it now. Thanks!
Have you set it up to specifically be multi-line? If your using VC++''s resource editor, there should be a check box somewhere in the property page.

--TheGoop
Advertisement
Instead of using the \n explicitly, try using hex characters:

wsprintf((char*)&Buffer, "Line 1%c%c", 0x0a, 0x0d);
Actually I think you want \r\n not \n\r
\r\n is perfect - thanks very much anon!

This topic is closed to new replies.

Advertisement