Click here to Skip to main content
16,013,581 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralMacro Pin
Anthony988719-Jan-04 13:23
Anthony988719-Jan-04 13:23 
GeneralRe: Macro Pin
Snyp19-Jan-04 13:59
Snyp19-Jan-04 13:59 
GeneralMFC questions Pin
Binayak19-Jan-04 12:27
Binayak19-Jan-04 12:27 
GeneralRe: MFC questions Pin
Ravi Bhavnani19-Jan-04 12:34
professionalRavi Bhavnani19-Jan-04 12:34 
GeneralRe: MFC questions Pin
Binayak19-Jan-04 12:50
Binayak19-Jan-04 12:50 
GeneralRe: MFC questions Pin
Ravi Bhavnani19-Jan-04 12:57
professionalRavi Bhavnani19-Jan-04 12:57 
GeneralRe: MFC questions Pin
Binayak19-Jan-04 13:11
Binayak19-Jan-04 13:11 
GeneralRe: MFC questions Pin
Ravi Bhavnani19-Jan-04 13:25
professionalRavi Bhavnani19-Jan-04 13:25 
I think you might be confusing a CTabCtrl with a CPropertySheet. A CTabCtrl doesn't "contain" child dialogs or controls - all it does is allow the user to select a tab. A tab control's parent receives notifications when the current tab selection changes.

That being said, what you probably want to do (to mimic the behavior of a CPropertySheet) is to create a bunch of child controls/dialogs (whose common parent is your view), one of which is displayed in response to the change in the currently selected tab. You'll also need to check the "Transparent" attribute of the tab control so that it doesn't hide the child controls/dialogs. The appropriate control/dialog is displayed in response to a change in the currently selected tab in the following manner:

// First hide all controls
CWnd* pDisplayedWnd = NULL;
m_treeCtrl_1.ShowWindow (SW_HIDE);
m_treeCtrl_2.ShowWindow (SW_HIDE);

// Next, determine which one should be shown
int nCurTab = m_tabCtrl.GetCurSel();
switch (nCurTab) {
  case 0:
    pDisplayedWnd = &m_treeCtrl_1;
    break;
  case 1:
    pDisplayedWnd = &m_treeCtrl_2;
    break;
  default:
    // Did you forget to support a tab?
    ASSERT (FALSE);
    break;
}
ASSERT (pDisplayedWnd != NULL);

// Display the control
pDisplayedWnd->BringWindowToTop();
pDisplayedWnd->ShowWindow (SW_SHOW);
pDisplayedWnd->Invalidate();
pDisplayedWnd->UpdateWindow();
pDisplayedWnd->BringWindowToTop();
pDisplayedWnd->SetFocus();
If this is too much work, you might want to consider using a CPropertySheet. See the examples at CP if you need help.

/ravi

My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com

GeneralRe: MFC questions Pin
Roger Allen19-Jan-04 23:35
Roger Allen19-Jan-04 23:35 
GeneralRe: MFC questions Pin
Binayak20-Jan-04 10:00
Binayak20-Jan-04 10:00 
GeneralRe: MFC questions Pin
Binayak20-Jan-04 10:33
Binayak20-Jan-04 10:33 
GeneralQuestion about DRIVE_LAYOUT_INFORMATION Pin
Cyrus Dang19-Jan-04 11:58
Cyrus Dang19-Jan-04 11:58 
GeneralLogging in as another user from a service Pin
Navin19-Jan-04 10:53
Navin19-Jan-04 10:53 
GeneralRe: Logging in as another user from a service Pin
Garth J Lancaster19-Jan-04 11:09
professionalGarth J Lancaster19-Jan-04 11:09 
GeneralRe: Logging in as another user from a service Pin
Navin19-Jan-04 11:14
Navin19-Jan-04 11:14 
GeneralRe: Logging in as another user from a service Pin
Garth J Lancaster19-Jan-04 11:21
professionalGarth J Lancaster19-Jan-04 11:21 
GeneralRe: Logging in as another user from a service Pin
Garth J Lancaster19-Jan-04 11:28
professionalGarth J Lancaster19-Jan-04 11:28 
GeneralRe: Logging in as another user from a service Pin
Navin19-Jan-04 11:34
Navin19-Jan-04 11:34 
GeneralPerformance issues Pin
lpRomang19-Jan-04 10:52
lpRomang19-Jan-04 10:52 
GeneralRe: Performance issues Pin
фил21-Jan-04 4:33
фил21-Jan-04 4:33 
GeneralStubborn mnemonics Pin
satcat19-Jan-04 9:48
satcat19-Jan-04 9:48 
GeneralRe: Stubborn mnemonics Pin
Michael Dunn19-Jan-04 10:28
sitebuilderMichael Dunn19-Jan-04 10:28 
GeneralRe: Stubborn mnemonics Pin
satcat19-Jan-04 14:11
satcat19-Jan-04 14:11 
GeneralMDI WS_SYSMENU question... Pin
RobJones19-Jan-04 9:26
RobJones19-Jan-04 9:26 
GeneralRe: MDI WS_SYSMENU question... Pin
Ivor S. Sargoytchev19-Jan-04 11:44
Ivor S. Sargoytchev19-Jan-04 11:44 

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.