Thread: WS_TABSTOP help & skinning

  1. #1
    Shibby willc0de4food's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    378

    WS_TABSTOP help & skinning

    hey, is the WS_TABSTOP style available for usage with buttons? and edit boxes? i'm assuming so, but in my win32 app i've specified the style when in my createwindowex but i'm unable to tab between the different controls. time4code
    Code:
    case WM_CREATE:
                 CreateWindowEx(0, TEXT("STATIC"), TEXT("Currently converting: "), WS_CHILD | WS_VISIBLE | SS_SIMPLE, 
                 25, 8, 136, 23, hwnd, (HMENU)ID_TEXT1, g_hInst, NULL);
                 
                 CreateWindowEx(0, TEXT("STATIC"), TEXT(""), WS_CHILD | WS_VISIBLE | SS_SIMPLE, 
                 137, 8, 150, 23, hwnd, (HMENU)ID_LABEL1, g_hInst, NULL);
                 
                 CreateWindowEx(0, TEXT("STATIC"), TEXT(""), WS_CHILD | WS_VISIBLE | SS_SIMPLE, 
                 25, 74, 130, 23, hwnd, (HMENU)ID_LABEL2, g_hInst, NULL);
                 
                 CreateWindowEx (WS_EX_CLIENTEDGE,                    /* more or 'extended' styles */
                                 TEXT("EDIT"),                        /* 'class' of control to create */
                                 TEXT(""),                            /* text displayed in the control */
                                 WS_CHILD | WS_VISIBLE | WS_BORDER,   /* how it looks */
                                 131,                                 /* control position: from left */
                                 74,                                 /* control position: from top */
                                 100,                                 /* control width */
                                 20,                                  /* control height */
                                 hwnd,                                /* parent window handle */
                                 (HMENU)ID_LABEL3,                    /* control's ID */
                                 g_hInst,                             /* application instance */
                                 NULL);
                                 
                 CreateWindowEx (0, TEXT("BUTTON"), TEXT("Convert"), 
                 WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON | WS_TABSTOP, 130, 114, 104, 23, hwnd, (HMENU)ID_TEXT2, g_hInst, NULL);
                 
                 CreateWindowEx(0, TEXT("STATIC"), TEXT(""), WS_CHILD | WS_VISIBLE | SS_SIMPLE | WS_TABSTOP, 
                 25, 178, 130, 23, hwnd, (HMENU)ID_LABEL4, g_hInst, NULL);
                 
                 CreateWindowEx(WS_EX_CLIENTEDGE, TEXT("EDIT"), TEXT(""), WS_CHILD | WS_VISIBLE | WS_BORDER | ES_READONLY, 
                 131, 178, 100, 20, hwnd, (HMENU)ID_LABEL5, g_hInst, NULL);
                 
                 CreateWindowEx(0, TEXT("BUTTON"), TEXT("Clear"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | WS_TABSTOP, 
                 130, 218, 104, 23, hwnd, (HMENU)ID_TEXT3, g_hInst, NULL);
                 
                 CreateWindowEx(0, TEXT("STATIC"), TEXT(""), WS_CHILD | SS_SIMPLE, 272, 8, 0, 16, 
                 hwnd, (HMENU)ID_LABEL6, g_hInst, NULL);
                 
                 CreateWindowEx(0, TEXT("BUTTON"), TEXT("Exit"), WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON, 
                 100, 256, 104, 23, hwnd, (HMENU)ID_FILE_CLOSE, g_hInst, NULL);
                 
                 EnblWndw(hwnd, 0);
            break;
    EnblWndw is a function i made to disable my controls until the user does blah blah blah (unimportant);

    for the skinning questions, if i just wanted the titlebar, _ ◘ X buttons, and border of the window skinned...how would i go about doing this? would i load the bitmaps and then do something?

    thanks
    Registered Linux User #380033. Be counted: http://counter.li.org

  2. #2
    Registered User Dante Shamest's Avatar
    Join Date
    Apr 2003
    Posts
    970
    I think putting WS_TABSTOP is not enough, you'll have to use the IsDialogMessage in the message loop.

    As for the skinning, this topic may be of interest.
    Last edited by Dante Shamest; 10-19-2005 at 08:56 AM.

  3. #3
    Shibby willc0de4food's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    378
    is this also true for handling the BS_DEFPUSHBUTTON?

    also - how should i handle the IsDialogMessage? i've tried
    Code:
        while (GetMessage (&messages, NULL, 0, 0))
        {
          if (IsDialogMessage(hwnd, &messages) || !IsDialogMessage(hwnd, &messages))
          {
            TranslateMessage(&messages);
            DispatchMessage(&messages);
          }
        }
    and
    Code:
        while (GetMessage (&messages, NULL, 0, 0))
        {
          if (IsDialogMessage(hwnd, &messages))
          {
            TranslateMessage(&messages);
            DispatchMessage(&messages);
          }
          else if (!IsDialogMessage(hwnd, &messages))
          {
            TranslateMessage(&messages);
            DispatchMessage(&messages);
          }
        }
    and now tabbing between the items will work, but it doesn't do anything for the default pushbutton and when i press a key, it inserts whatever key it was 4 times. so if i press 1, in the edit box i get '1111'. ?

    thanks
    Last edited by willc0de4food; 10-19-2005 at 10:03 AM.
    Registered Linux User #380033. Be counted: http://counter.li.org

  4. #4
    Registered User Dante Shamest's Avatar
    Join Date
    Apr 2003
    Posts
    970
    Try this.

    Code:
        while (GetMessage (&messages,0,0,0) > 0 )
        {
          if ( !IsDialogMessage(hwnd, &messages) )
          {
            TranslateMessage(&messages);
            DispatchMessage(&messages);
          }
        }

  5. #5
    Shibby willc0de4food's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    378
    of course, the one i left out.. :-[ lol thx.
    Registered Linux User #380033. Be counted: http://counter.li.org

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. skinning windows
    By Anuradh_a in forum Windows Programming
    Replies: 4
    Last Post: 06-02-2008, 08:32 AM
  2. Good News about skinning windows!
    By Queatrix in forum Windows Programming
    Replies: 2
    Last Post: 08-20-2006, 04:59 AM
  3. Skinning Win32 Applications
    By Prog.Patterson in forum Windows Programming
    Replies: 2
    Last Post: 02-11-2002, 10:54 AM
  4. Window Skinning Lib!
    By minime6696 in forum Windows Programming
    Replies: 1
    Last Post: 02-02-2002, 07:27 PM