Thread: Tabbing not working

  1. #1
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879

    Tabbing not working

    Hey guys, I've been having some tabbing issues for a while. I create a dialog resource in MSVC, add a bunch of textboxes, etc. and then use it in my program as the main window. For some reason, hitting tab won't switch between the buttons/edits - although it works fine when I go to Layout->Test, which suggests to me that I'm doing something wrong in code. Can anyone give me an idea as to what's wrong? (i.e. do I need to process a certain message to make it work or something?)
    Last edited by Hunter2; 05-13-2004 at 08:51 AM.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  2. #2
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    If you are using a modeless dialog, are you calling IsDialogMessage() in your message loop?

    MSDN Using Dialogs page gives this sample:
    Code:
    BOOL bRet;
    
    while ( (bRet = GetMessage(&msg, NULL, 0, 0)) != 0 ) 
    { 
        if (bRet == -1 )
        {
            // handle the error and possibly exit
        }
        else if (!IsWindow(hwndDialog) || !IsDialogMessage(hwndDialog, &msg)) 
        { 
            TranslateMessage(&msg); 
            DispatchMessage(&msg); 
        } 
    }

  3. #3
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    Hmm, never heard of it. I'll check it out, thanks!
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  4. #4
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    Ok, I've finally gotten around to looking at the docs. I believe that you're right; my problem probably is the missing IsDialogMessage(), although I haven't had the chance to test it yet (the code's at school). Strange though, I don't recall ever using it before, and I'm almost positive that tabbing used to work on other dialog boxes. Why would Windows need a separate IsDialogMessage() call to do the message-converting anyways? I mean, it might as well be an automatic feature, or the OS could just send the right messages in the first place instead of sending the wrong one and making you convert it...
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  5. #5
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    >>tabbing used to work on other dialog boxes<<

    Probably a modal dialog box where the system manages the message loop and presumably calls IsDialogMessage internally. With modeless dialog boxes you manage your own message loop and are therefore free to include or exclude default dialog box keyboard behaviour at your discretion.

    >>Why would Windows need a separate IsDialogMessage() call to do the message-converting anyways?<<

    By having a separate function you could give a 'normal' window (ie. one created with CreateWindowEx) similar 'tabbing' and other dialog-type keyboard handling capability. You are also free, as previously mentioned, to use a modeless dialog with or without that aspect of default dialog behaviour.

    If you want that kind of keyboard response by default without using IsDialogMessage or a message loop then use a modal dialog box.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  6. #6
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    Ah, thanks. Makes sense
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Function not working
    By sloopy in forum C Programming
    Replies: 31
    Last Post: 11-12-2005, 08:08 PM
  2. Program Not working Right
    By raven420smoke in forum C++ Programming
    Replies: 2
    Last Post: 09-16-2005, 03:21 AM
  3. Trying to eject D drive using code, but not working... :(
    By snowfrog in forum C++ Programming
    Replies: 3
    Last Post: 05-07-2005, 07:47 PM
  4. x on upper right corner not working
    By caduardo21 in forum Windows Programming
    Replies: 1
    Last Post: 02-20-2005, 08:35 PM
  5. cygwin -> unix , my code not working properly ;(
    By CyC|OpS in forum C Programming
    Replies: 4
    Last Post: 05-18-2002, 04:08 AM