From: Chester on
Hi guyz,
I have been trying hard to use tabcontrol in vc+ win32 api but cant
find any tutorials or useful information in msdn to help me.

So far i have made 2 dialogs in resource editor Dialog1 and Dialog2
and added tab control to Dialog1 and now i want to display dialog2 as
first tabpage on tabcontrol mentioned above.
Till now i have sucessfully added and displayed a tabcontrol with two
tabpages but with titles only.
Can any1 tell me how to add dialog to a tabpage now ???

Function i am currently using to initialize tabcontrol -

void InitTabControl(HWND tabHandle)
{
TCITEM item;
item.mask = TCIF_TEXT;
item.pszText = L"Appearence";
item.cchTextMax = 6;
item.iImage = -1;
item.dwState = TCIS_BUTTONPRESSED;
SendMessage(tabHandle,TCM_INSERTITEM,(WPARAM)0,(LPARAM)
(LPTCITEM)&item);

item.mask = TCIF_TEXT;
item.pszText = L"Particles";
item.cchTextMax = 6;
item.iImage = -1;
item.dwState = TCIS_BUTTONPRESSED;
SendMessage(tabHandle,TCM_INSERTITEM,(WPARAM)1,(LPARAM)
(LPTCITEM)&item);

}


From: Leslie Milburn on

"Chester" <juggydhl(a)gmail.com> wrote in message
news:d36de17e-217b-419c-9fc6-df71ebaa7bc5(a)s36g2000prh.googlegroups.com...
> Hi guyz,
> I have been trying hard to use tabcontrol in vc+ win32 api but cant
> find any tutorials or useful information in msdn to help me.
>
> So far i have made 2 dialogs in resource editor Dialog1 and Dialog2
> and added tab control to Dialog1 and now i want to display dialog2 as
> first tabpage on tabcontrol mentioned above.
> Till now i have sucessfully added and displayed a tabcontrol with two
> tabpages but with titles only.
> Can any1 tell me how to add dialog to a tabpage now ???
>
> Function i am currently using to initialize tabcontrol -
>
> void InitTabControl(HWND tabHandle)
> {
> TCITEM item;
> item.mask = TCIF_TEXT;
> item.pszText = L"Appearence";
> item.cchTextMax = 6;
> item.iImage = -1;
> item.dwState = TCIS_BUTTONPRESSED;
> SendMessage(tabHandle,TCM_INSERTITEM,(WPARAM)0,(LPARAM)
> (LPTCITEM)&item);
>
> item.mask = TCIF_TEXT;
> item.pszText = L"Particles";
> item.cchTextMax = 6;
> item.iImage = -1;
> item.dwState = TCIS_BUTTONPRESSED;
> SendMessage(tabHandle,TCM_INSERTITEM,(WPARAM)1,(LPARAM)
> (LPTCITEM)&item);
>
> }
>

When a Tab is clicked you are sent a WM_NOTIFY message and in response you
open Dialog 2 and place it over the top of the tab control. Thats it.


From: ScottMcP [MVP] on
On Mar 3, 2:03 pm, Chester <juggy...(a)gmail.com> wrote:
> Till now i have sucessfully added and displayed a tabcontrol with two
> tabpages but with titles only.
> Can any1 tell me how to add dialog to a tabpage now ???

In the dialogs turn off the titlebar style and border style. That will
make them look like part of the tab control.

You can create both of the dialogs when you create the tab control.
(Use CreateDialog). Make one visible and one invisible. Use
MoveWindow to place it on the tab control. When a tab is clicked make
the appropriate one visible and the other one invisible.

From: Chester on
Thanx for helping but am kinda stuck in CreateDialog only. Dunno why
it is not working am copy pasting the new code here -
(Is there any way to show code in blocks ?)

void InitTabControl(HWND tabHandle)
{
TCITEM item;
item.mask = TCIF_TEXT;
item.pszText = L"Appearence";
item.cchTextMax = 6;
item.iImage = -1;
item.dwState = TCIS_BUTTONPRESSED;
SendMessage(tabHandle,TCM_INSERTITEM,(WPARAM)0,(LPARAM)
(LPTCITEM)&item);

item.mask = TCIF_TEXT;
item.pszText = L"Particles";
item.cchTextMax = 6;
item.iImage = -1;
item.dwState = TCIS_BUTTONPRESSED;
SendMessage(tabHandle,TCM_INSERTITEM,(WPARAM)1,(LPARAM)
(LPTCITEM)&item);

colorDialogHandle =
CreateDialog(hInst,MAKEINTRESOURCE(IDD_DIALOGColor),
GetDlgItem(settingHandle,IDC_TAB1),WndProcColor);
if(colorDialogHandle==NULL)
{
MessageBox(0,L"Error Creating Color Dialog",0,0);
}

ShowWindow(colorDialogHandle,SW_HIDE);

particlesDialogHandle =
CreateDialog(hInst,MAKEINTRESOURCE(IDD_DIALOGParticles),
GetDlgItem(settingHandle,IDC_TAB1),WndProcParticles);

if(particlesDialogHandle==NULL)
{
MessageBox(0,L"Error Creating Particles Dialog",0,0);
}


ShowWindow(particlesDialogHandle,SW_HIDE);

ShowTabDialog(0);

}


///////////Some code from resource.rc for all 3 dialogs /////////////

/////////Dialog settings
IDD_DIALOGSETTINGS DIALOGEX 0, 0, 350, 212
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE
| WS_CAPTION | WS_SYSMENU
CAPTION "Particle System Editor Settings "
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CONTROL "",IDC_TAB1,"SysTabControl32",0x0,7,7,336,198
END

///////////DialogColor

IDD_DIALOGColor DIALOGEX 0, 0, 276, 174
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_SYSMENU
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
GROUPBOX "Blend Options",IDC_STATIC,7,7,113,55,BS_CENTER
LTEXT "SrcBlend",IDC_STATIC,14,23,28,8
LTEXT "DestBlend",IDC_STATIC,15,44,33,8
COMBOBOX IDC_COMBOSrcBlend,51,22,58,41,CBS_DROPDOWN |
CBS_SORT | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_COMBODestBlend,51,41,58,41,CBS_DROPDOWN |
CBS_SORT | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Choose Texture",IDC_BUTTONChooseTexture,
165,16,61,14
PUSHBUTTON "Clear Texture",IDC_BUTTONClearTexture,
165,36,61,14
GROUPBOX "Particle Color",IDC_STATIC,7,68,246,54,BS_CENTER
GROUPBOX "Minimum",IDC_STATIC,14,75,111,44,BS_CENTER
GROUPBOX "Maximum",IDC_STATIC,131,75,115,44,BS_CENTER
PUSHBUTTON "color",IDC_BUTTONColorMin,23,92,22,14
LTEXT "Alpha",IDC_STATIC,54,95,19,8
EDITTEXT IDC_EDITColorMin,82,92,28,14,ES_AUTOHSCROLL
PUSHBUTTON "color",IDC_BUTTONColorMax,140,90,22,14
LTEXT "Alpha",IDC_STATIC,171,92,19,8
EDITTEXT IDC_EDITColorMax,199,90,28,14,ES_AUTOHSCROLL
PUSHBUTTON "Save",IDC_BUTTONSave,15,153,50,14
PUSHBUTTON "Load",IDC_BUTTONLoad,87,153,50,14
END


/////////////////////////Dialog Particles
IDD_DIALOGParticles DIALOGEX 0, 0, 275, 180
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 400, 0, 0x1