Thread: Edit boxes and tabs

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    28

    Edit boxes and tabs

    Is there a way to make an edit box accept tab characters? When I hit tab in an edit box it jumps to the next button, but I want it to treat that as a tab character (or turn it into a few 'space' characters). Is there a way to do this? Thanks.
    -Grunt (Malek)

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    Something I've never needed to do. There does not appear to be an obvious answer, I'll think about it.

    Of course, you could always process the tab key press yourself and do whatever you like rather than pass it to the default handler.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  3. #3
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    AFAIK edit controls will not accept a TAB key as input.

    To stop the TAB changing ctrls try removing the
    WS_TABSTOP
    from your script.rc or uncheck the box in the resource editor.

    >>Of course, you could always process the tab key press yourself and do whatever you like rather than pass it to the default handler.
    Look at WM_KEYDOWN and VK_TAB. You may be able to write in your own code for a TAB.


    Possibly a different ctrl is what you are looking for. Such as a report style listview (columns can act as TAB spacings).
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  4. #4
    Registered User
    Join Date
    Sep 2001
    Posts
    28

    Stumbled across a solution

    I stumbled across a solution when I was trying to find a way to translate WM_CHAR messages. When I was translating messages in my main function, I used to be doing:

    while (GetMessage(&msg, NULL, 0, 0))
    {
    if (!IsDialogMessage(hWndMain, &msg))
    {
    TranslateMessage(&msg);
    DispatchMessage(&msg);
    }
    }

    But I couldn't get the main handler to ever receive a WM_CHAR or WM_KEYDOWN character, so I thought the !IsDialogMessage might be blocking it. So I remarked it out, and now tab keys actually appear as tab keys in the edit control. This may have some other side effects I haven't discovered yet, but it seems to work so far.
    -Grunt (Malek)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM