Results 1 to 12 of 12

Thread: Tab Control

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800

    Tab Control

    How could I make a tab control and put different controls (listbox) in each section (i want 3). Im guessing you can use CreateWindow for the tab. But how would I add things to different tabs? Thanks

  2. #2

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    4 and a half hours being posted and only 4 views including mine!?!?!?!? sheesh.

  3. #3
    Megatron
    Guest
    To create the tab control, use the CreateWindowEx function, and specify the WC_TABCONTROL constant as the window name. Since this is a common control, you need to link it with comctrl32.lib (I think that's the name) and call the InitCommonControls() function upon starting your App.

    Next off, Tab control is not a parent window, hence you need to toggle each window's visibility when a tab is clicked. To tell when the tab is clicked, you need to process the TCN_SELCHANGING notification message (sent in the form of WM_NOTIFY).

    The TabCtrl_GetCurSel macro or the TCM_GETCURSEL message tells the currently selected tab. You need to check which tab is selected, and toggle the visibility of your controls accordingly.

    If you didn't understand this, let me know, and I'll write an example up for you.

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    Thanks megatron. One problem, I get this error
    error C2065: 'InitCommonControls' : undeclared identifier
    I've added the library file, InitComControls() didn't work either....

    thanks

  5. #5
    Megatron
    Guest
    Did you remember to include the header file?

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    comctrl32.h isn't on my computer....so what iis the name of it?

  7. #7
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    commctrl.h, InitCommonControlsEx I think...but tab controls probably don't need loading.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  8. #8

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    InitCommonControlsEx() doesn't take 0 parameters it says. What goes in it? (the little tooltip mean nothing )and if I comment that out it says it can't open comctrl32.lib


  9. #9

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    when I say InitCommonControls() it says comctrl32.lib can't be opened.

  10. #10
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827
    In order to user common controls library, you need to do two things. First add the header "commctrl.h" at the top of your file, and then add the lib file "comctl32.lib" in your project library list.
    Baaaaaaaaah

  11. #11

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    oh I entered comctrl32.lib not comctl32.lib thanks, now it runs....but how would I now show the tab control? like what should I enter into CreateWindow?

  12. #12
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827
    Originally posted by SteveCRM
    oh I entered comctrl32.lib not comctl32.lib thanks, now it runs....but how would I now show the tab control? like what should I enter into CreateWindow?
    You use "WC_TABCONTROL" with CreateWindow. Here is a little example:

    PHP Code:
    CreateWindow(
            
    WC_TABCONTROL"",
            
    WS_CHILD WS_CLIPSIBLINGS WS_VISIBLE,
            
    00100100,
            
    hwndDlgNULLg_hinstNULL
            
    ); 
    I suggest that you read all about tab controls from here; it'll help you a lot:
    http://msdn.microsoft.com/library/de...Tab/Styles.asp

    I have never used tab control because I always use propertysheet (which uses tab control itself) and I make different dialog box for each tab control.
    Baaaaaaaaah

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width