|
-
Nov 3rd, 2001, 12:25 PM
#1
Thread Starter
Frenzied Member
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
-
Nov 3rd, 2001, 04:56 PM
#2
Thread Starter
Frenzied Member
4 and a half hours being posted and only 4 views including mine!?!?!?!? sheesh.
-
Nov 3rd, 2001, 05:49 PM
#3
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.
-
Nov 3rd, 2001, 06:40 PM
#4
Thread Starter
Frenzied Member
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
-
Nov 3rd, 2001, 07:00 PM
#5
Did you remember to include the header file?
-
Nov 3rd, 2001, 07:14 PM
#6
Thread Starter
Frenzied Member
comctrl32.h isn't on my computer....so what iis the name of it?
-
Nov 3rd, 2001, 08:04 PM
#7
Monday Morning Lunatic
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
-
Nov 3rd, 2001, 09:56 PM
#8
Thread Starter
Frenzied Member
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
-
Nov 4th, 2001, 08:55 AM
#9
Thread Starter
Frenzied Member
when I say InitCommonControls() it says comctrl32.lib can't be opened.
-
Nov 4th, 2001, 11:18 AM
#10
PowerPoster
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.
-
Nov 4th, 2001, 11:59 AM
#11
Thread Starter
Frenzied Member
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?
-
Nov 4th, 2001, 12:27 PM
#12
PowerPoster
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,
0, 0, 100, 100,
hwndDlg, NULL, g_hinst, NULL
);
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|