New line (\n) doesn't work in edit box

This is a discussion on New line (\n) doesn't work in edit box within the Windows Programming forums, part of the Platform Specific Boards category; Code: hr = CreateWindowEx ( 0, /* Extended possibilites for variation */ "Edit", /* Classname */ "\nHello\n\n\nHello", ES_MULTILINE|WS_VISIBLE|WS_CHILD|ES_AUTOHSCROLL|ES_READONLY|WS_HSCROLL|WS_VSCROLL|ES_CENTER, /* default ...

  1. #1
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318

    New line (\n) doesn't work in edit box

    Code:
                     hr = CreateWindowEx (
               0,                   /* Extended possibilites for variation */
               "Edit",         /* Classname */
               "\nHello\n\n\nHello",
               ES_MULTILINE|WS_VISIBLE|WS_CHILD|ES_AUTOHSCROLL|ES_READONLY|WS_HSCROLL|WS_VSCROLL|ES_CENTER, /* default window */
               0,       /* Windows decides the position */
               0,       /* where the window ends up on the screen */
               50,                 /* The programs width */
               50,                 /* and height in pixels */
               hwnd,        /* The window is a child-window to desktop */
               (HMENU)IDB_RUBS,                /* No menu */
               GetModuleHandle(NULL),       /* Program Instance handler */
               NULL                 /* No Window Creation data */
               );
    \n doesn't work in edit box?

  2. #2
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    You need to use the Windows newline sequence which is "\r\n", or a carriage return(\r) followed by a line feed (\n).

  3. #3
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    You need to do that when ever you want a break in your text. The only one you can get away with is MessageBox().

  4. #4
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    I just didn't know, how to make new line in edit box, it isn't any problem now...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 02-13-2008, 01:59 PM
  2. How do I make my edit box move text to the next line?
    By ElWhapo in forum Windows Programming
    Replies: 2
    Last Post: 01-04-2005, 10:21 PM
  3. setting fixed floats in edit box
    By WaterNut in forum Windows Programming
    Replies: 4
    Last Post: 08-13-2004, 09:13 AM
  4. newbie to rich edit, cant get it to work
    By hanhao in forum Windows Programming
    Replies: 1
    Last Post: 03-24-2004, 09:54 PM
  5. Get Notified of ENTER in single line EDIT control
    By Morpheus in forum Windows Programming
    Replies: 1
    Last Post: 06-29-2002, 07:07 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21