Advertisement

Newlines ignored when setting Edit box text

Started by June 06, 2002 02:48 PM
3 comments, last by Raskolnikov 22 years, 6 months ago
I am new to win 32 api programming and am having trouble with edit boxes. I am implementing various graphics algorithm from a book. Each algorithm has a dialog box that allows the user to set pramaters, and a "veiw source" button that opens another dialog box and displays the algorithms source in an edit box. Here is my problem. When I send the string with the appropriate source code to the edit box the newlines are printed as black bars and all the formating is lost. The edit box is set to multiline and if I type in it carrige returns work as expected, but when I send a string they are printed as black bars instead. I tried \n \f \r \v nothing seems to work. If I use a MessageBox the newlines work, but then I can cut and past the source code. Is there anywhar to set the text of an edit box and have newlines work! EDITTEXT IDC_EDIT,15,18,214,186,ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN | WS_VSCROLL char str[] ="line1\n\n\r\r\f\f\v\vstill on same line" SetDlgItemText(hdwnd, IDC_EDIT, sourceStr);
char* LineFeed = "\r\n"
Advertisement
strcpy(sourceStr, "line1\r\nStarts on next line");
SetDlgItemText(hdwnd, IDC_EDIT1, sourceStr);

-- And It works

Thanks, I spent hours tring to find an answer at MSDN library with no luck.




BTW where did you find this peice of information?
Knowing the answer I still can''t find it at MSDN library?
I have a CIS degree, but am new to the win 32 api (been studying it for three weeks).

If you have a question about how to use any Microsoft APIs (or apps for that matter) a great place to go is the Microsoft forums available from the MS website (the news server is msnews.microsoft.com).

This topic is closed to new replies.

Advertisement