Click here to Skip to main content
16,008,183 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalgraphics animation Pin
Earl Rex Arao-arao28-May-01 17:51
Earl Rex Arao-arao28-May-01 17:51 
GeneralRe: graphics animation Pin
Christian Graus28-May-01 18:14
protectorChristian Graus28-May-01 18:14 
GeneralRe: graphics animation Pin
29-May-01 18:21
suss29-May-01 18:21 
GeneralOutlook Exchange Extension Pin
Robbie Grundel28-May-01 15:18
Robbie Grundel28-May-01 15:18 
GeneralRe: Outlook Exchange Extension Pin
Michael P Butler29-May-01 1:18
Michael P Butler29-May-01 1:18 
GeneralATL Service Problems Pin
Mick Porter28-May-01 15:15
Mick Porter28-May-01 15:15 
GeneralIPerPropertyBrowsing Pin
Corneliu28-May-01 14:46
Corneliu28-May-01 14:46 
GeneralTab Control Problems using Win32 API Pin
Lito28-May-01 14:14
Lito28-May-01 14:14 
OK, here's the situation. I'm working on a dialog-based app and I would
like to use a tab control and a "sheet" for each tab. Each "sheet" is a
dialog that is the child of the tab control. I have a few problems I am
trying to work out, and I think all of them are in the message-handling
code.

Problems:
1. Each sheet is not placed directly under the tabs, instead it is placed
right over them. Is there a function I should call to get the rect of the
display area right below the tabs?

2. When the dialog is first opened, no sheet is shown. Do I put the
ShowWindow call in WM_INITDIALOG, or somewhere else?

3. When I try to click on any control in any of the sheets, my app freezes.
Are there any parameters I need to set to overcome this?

4. Ctrl-Tab doesn't work for some reason. Do I need to implement this
myself, or is it supposed to be automatically supported?

Below is the code for the message handler of the tab control. Please note
that hPropPage is an array of HWND's to each sheet in the tab control, and
hTabCtrl is an HWND to the tab control window. Sorry if this code looks
messy, as I'm new to the Win32 API. Also, please note that I cannot use MFC
or any other API and I'm programming in C, not C++.

Thanks
-Lito

static BOOL CALLBACK ConfigProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
LPARAM lParam)
{
NMHDR nmhdr;
int i;

switch (uMsg)
{
case WM_COMMAND:
switch (LOWORD(wParam))
{
// For now, they do the same...
// In the future, any changes will be saved
// as soon as user does the change, and
// the Cancel button needs to perform a rollback
case IDOK:
case IDCANCEL:
EndDialog(hwndDlg, 0);
break;
}
return FALSE;

case WM_INITDIALOG:
// Show the first page
byCurrentPage = 0;
ShowWindow(hPropPage[byCurrentPage], SW_SHOW);
return FALSE;

case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code)
{
case TCN_SELCHANGING:
nmhdr.hwndFrom = GetDlgItem(hwndDlg, IDC_TAB);
nmhdr.idFrom = IDC_TAB;
nmhdr.code = PSN_KILLACTIVE;
byCurrentPage = TabCtrl_GetCurSel(hTabCtrl);
if(SendMessage(hPropPage[byCurrentPage], WM_NOTIFY, (WPARAM)IDC_TAB,
(LPARAM) &nmhdr))
{
// Prevent the selection from changing
SetWindowLong(hwndDlg, DWL_MSGRESULT, TRUE);
return TRUE;
}

// Hide the current child dialog box
ShowWindow(hPropPage[byCurrentPage], SW_HIDE);
UpdateWindow(hwndDlg);
break;

case TCN_SELCHANGE:
// Grab the index of the next page to display
byCurrentPage = TabCtrl_GetCurSel(hTabCtrl);

// Show the current page
ShowWindow(hPropPage[byCurrentPage], SW_SHOW);

// Let the page know it is now active
nmhdr.hwndFrom = hTabCtrl;
nmhdr.idFrom = IDC_TAB;
nmhdr.code = PSN_SETACTIVE;
SendMessage(hPropPage[byCurrentPage], WM_NOTIFY, (WPARAM)IDC_TAB,
(LPARAM) &nmhdr);
break;
}
return FALSE;
}

return FALSE;
}

GeneralRe: Tab Control Problems using Win32 API Pin
Tomasz Sowinski29-May-01 0:32
Tomasz Sowinski29-May-01 0:32 
QuestionHuman Debuuger? Pin
28-May-01 12:29
suss28-May-01 12:29 
AnswerRe: Human Debuuger? Pin
Christian Graus28-May-01 12:37
protectorChristian Graus28-May-01 12:37 
GeneralBlinking text Pin
28-May-01 12:01
suss28-May-01 12:01 
GeneralRe: Blinking text Pin
28-May-01 12:21
suss28-May-01 12:21 
GeneralProblems with resource files and software translation Pin
Mustafa Demirhan28-May-01 11:10
Mustafa Demirhan28-May-01 11:10 
GeneralRe: Localization issue. Pin
Masaaki Onishi28-May-01 12:44
Masaaki Onishi28-May-01 12:44 
GeneralResource ID Organiser Add-In Pin
Anna-Jayne Metcalfe29-May-01 23:52
Anna-Jayne Metcalfe29-May-01 23:52 
Generalprotection of seialized file Pin
28-May-01 10:27
suss28-May-01 10:27 
GeneralRe: protection of seialized file Pin
markkuk28-May-01 20:27
markkuk28-May-01 20:27 
GeneralRe: protection of seialized file Pin
28-May-01 20:50
suss28-May-01 20:50 
GeneralRemoving point labels in TeeChart ActiveX Pin
28-May-01 9:40
suss28-May-01 9:40 
GeneralGeneral Question Pin
mr200328-May-01 8:56
mr200328-May-01 8:56 
GeneralRe: General Question Pin
ThunderBird28-May-01 9:26
ThunderBird28-May-01 9:26 
GeneralMFC and WinHelp. Arghh!!! Pin
Anders Molin28-May-01 8:46
professionalAnders Molin28-May-01 8:46 
GeneralRe: MFC and WinHelp. Arghh!!! Pin
Tomasz Sowinski28-May-01 8:57
Tomasz Sowinski28-May-01 8:57 
GeneralRe: MFC and WinHelp. Arghh!!! Pin
Anders Molin28-May-01 9:24
professionalAnders Molin28-May-01 9:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.