Tab order in graphically designed forms(MSVC)

This is a discussion on Tab order in graphically designed forms(MSVC) within the Windows Programming forums, part of the Platform Specific Boards category; I'm designing forms in MSVC using the resource editor. I'm not using MFC. You can set the tab-order in the ...

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    329

    Tab order in graphically designed forms(MSVC)

    I'm designing forms in MSVC using the resource editor. I'm not using MFC.
    You can set the tab-order in the editor, but this doesn't always work..
    Am I missing something obvious here/intercepting some message i shouldn't?

    I'm processing the VM_SETFOCUS / WM_INITDIALOG / WM_COMMAND / WM_DESTROY messages, returning 0 from dialogproc for unused switches..

  2. #2
    Magically delicious LuckY's Avatar
    Join Date
    Oct 2001
    Posts
    856

    Re: Tab order in graphically designed forms(MSVC)

    Originally posted by knutso
    I'm designing forms in MSVC using the resource editor. I'm not using MFC.
    You can set the tab-order in the editor, but this doesn't always work..
    You can set the tab-order in the editor? How can you do that? I know it's easy in VB, but I am completely unaware of how you can possibly do it from within the resource editor in VC..
    The way that I accomplish it is by manually editing the data in the resource file. Just cut/paste the controls in the tab order you desire. For example, before:
    Code:
    IDD_FILEINFO DIALOG DISCARDABLE  0, 0, 219, 175
    STYLE WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | 
        WS_THICKFRAME
    FONT 8, "MS Sans Serif"
    BEGIN
        PUSHBUTTON      "Display Comment",IDC_CHGDSP,7,154,79,14
        DEFPUSHBUTTON   "Close",IDOK,162,154,50,14
        EDITTEXT        IDC_INF,7,48,205,99,ES_MULTILINE | ES_AUTOVSCROLL | 
                        ES_AUTOHSCROLL | ES_READONLY | ES_WANTRETURN | 
                        WS_VSCROLL | WS_HSCROLL
        EDITTEXT        IDC_FILENAME,7,19,205,14,ES_AUTOHSCROLL | ES_READONLY
        LTEXT           "Filename",IDC_STATIC,7,7,29,8
        CTEXT           "Static",IDC_DISPLAYING,7,37,205,8
    END
    and after:
    Code:
    IDD_FILEINFO DIALOG DISCARDABLE  0, 0, 219, 175
    STYLE WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | 
        WS_THICKFRAME
    FONT 8, "MS Sans Serif"
    BEGIN
        EDITTEXT        IDC_FILENAME,7,19,205,14,ES_AUTOHSCROLL | ES_READONLY // tab 1
        PUSHBUTTON      "Display Comment",IDC_CHGDSP,7,154,79,14              // tab 2
        EDITTEXT        IDC_INF,7,48,205,99,ES_MULTILINE | ES_AUTOVSCROLL |   // tab 3
                        ES_AUTOHSCROLL | ES_READONLY | ES_WANTRETURN | 
                        WS_VSCROLL | WS_HSCROLL
        DEFPUSHBUTTON   "Close",IDOK,162,154,50,14                            // tab 4
        LTEXT           "Filename",IDC_STATIC,7,7,29,8
        CTEXT           "Static",IDC_DISPLAYING,7,37,205,8
    END

  3. #3
    Registered User
    Join Date
    Feb 2002
    Posts
    329
    Thanks for the reply.
    You can set the tab order under the Layout menu: "Layout->Tab Order".

    I opened the resource script in Notepad, and the controls are listed in the tab order..
    The problem is that when the form is open, pressing the tab key has no effect.

  4. #4
    Magically delicious LuckY's Avatar
    Join Date
    Oct 2001
    Posts
    856
    Ohhhhhh, that's the problem?
    You can set the tab-order in the editor, but this doesn't always work..
    That makes it look like you have a problem with the tab order..

    Just do this:
    Code:
    while (GetMessage(&msg, 0, 0, 0) > 0) {
        if (!IsDialogMessage(hDialog, &msg)) {
          TranslateMessage(&msg);
          DispatchMessage(&msg);
        }
      }
    To note, this is a very common question as you may have gathered. A prime candidate for the <search> function.
    Last edited by LuckY; 05-15-2003 at 02:17 PM.

  5. #5
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,859
    Have you selected the TAB stop style for the control in the resource editor as well?
    "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

  6. #6
    Registered User
    Join Date
    Feb 2002
    Posts
    329
    Seems like the message loop worked...

    I'm sorry if this is a common question, but i tried to search, and didn't find anything.

    You have, anyhow, resolved my problem. Thanks.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Tab order in Tab Control
    By Halloko in forum Windows Programming
    Replies: 2
    Last Post: 05-09-2005, 12:08 AM
  2. Tab order again
    By knutso in forum Windows Programming
    Replies: 9
    Last Post: 07-29-2003, 06:39 PM
  3. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 10:44 AM
  4. Changing Tab Order
    By Tesita in forum Windows Programming
    Replies: 1
    Last Post: 01-11-2002, 08:43 AM
  5. V C++; dialog box; tab order; advancing thru
    By alzado in forum C++ Programming
    Replies: 2
    Last Post: 01-02-2002, 03:56 PM

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