Click here to Skip to main content
16,007,814 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Adding tabs to a CTabCrtl Pin
Michael P Butler30-Sep-02 22:08
Michael P Butler30-Sep-02 22:08 
GeneralRe: Adding tabs to a CTabCrtl Pin
Ravi Bhavnani1-Oct-02 4:42
professionalRavi Bhavnani1-Oct-02 4:42 
GeneralRe: Adding tabs to a CTabCrtl Pin
Ravi Bhavnani1-Oct-02 7:24
professionalRavi Bhavnani1-Oct-02 7:24 
GeneralRe: Adding tabs to a CTabCrtl Pin
monrobot131-Oct-02 12:36
monrobot131-Oct-02 12:36 
GeneralRe: Adding tabs to a CTabCrtl Pin
Ravi Bhavnani1-Oct-02 17:03
professionalRavi Bhavnani1-Oct-02 17:03 
GeneralRe: Adding tabs to a CTabCrtl Pin
monrobot132-Oct-02 13:24
monrobot132-Oct-02 13:24 
GeneralRe: Adding tabs to a CTabCrtl Pin
Ravi Bhavnani2-Oct-02 13:27
professionalRavi Bhavnani2-Oct-02 13:27 
GeneralRe: Adding tabs to a CTabCrtl Pin
monrobot133-Oct-02 13:23
monrobot133-Oct-02 13:23 
Hey Again,

I've finally tried implementing your CTabCtrl example and I'm having some trouble with it. I've implemented the code that you sent me but it still isn't working. The dialog with the tab control will load up and show the tab that I inserted, but it wont show the dialog that's supposed to be on the tab. Here's my OnInitDialog function:
BOOL CDataManDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	m_tabData.InsertItem (0, " Media Sales ");
	m_tabData.InsertItem (1, " Temp Garbage ");
	VERIFY (m_dlgSales.Create (IDD_MEDIASALES_DIALOG, this));
	m_dlgSales.SetFocus ();
		
	return FALSE;
}
I added a bogus tab so that I could test the TCN_SELCHANGE handler and when I click onto the first tab it creates the dialog but it's not inside the tab control, it's way off to the side. Here's my TCN_SELCHANGE handler:
void CDataManDlg::OnTabSelected(NMHDR* pNMHDR, LRESULT* pResult) 
{
	// Set a new current tab.
	int nCurrentTab = m_tabData.GetCurSel ();

	// Hide all the tabs.
	m_dlgSales.ShowWindow (SW_HIDE);

	// Get window of visible tabbed dialog.
	CWnd* pWndCurrentTab = NULL;
	switch (nCurrentTab) {
	case 0:
		pWndCurrentTab = &m_dlgSales;
		break;
	case 1:
		break;
	default:
		ASSERT (FALSE);
		break;
	}

	// Resize and show the dialog
	if (pWndCurrentTab != NULL) {
		CRect rectCtrl;
		GetDlgItem (FRAME_TAB_DIALOG)->GetWindowRect (&rectCtrl);
		ScreenToClient (&rectCtrl);

		pWndCurrentTab->MoveWindow (&rectCtrl, TRUE);
        pWndCurrentTab->ShowWindow (SW_SHOW);
		pWndCurrentTab->Invalidate ();
		pWndCurrentTab->UpdateWindow ();
		pWndCurrentTab->BringWindowToTop ();
		pWndCurrentTab->SetFocus ();
	}
	
	*pResult = 0;
}
I'm just wondering if you could tell what I'm doing wrong here, and would it be possible for you to send me a complete VC6 project?

Thanks again for the help it's been very much appreciated.

-monrobot13
GeneralRe: Adding tabs to a CTabCrtl Pin
monrobot133-Oct-02 13:35
monrobot133-Oct-02 13:35 
GeneralRe: Adding tabs to a CTabCrtl Pin
Ravi Bhavnani3-Oct-02 15:24
professionalRavi Bhavnani3-Oct-02 15:24 
GeneralRe: Adding tabs to a CTabCrtl Pin
monrobot135-Oct-02 8:38
monrobot135-Oct-02 8:38 
GeneralRe: Adding tabs to a CTabCrtl Pin
Ravi Bhavnani5-Oct-02 8:41
professionalRavi Bhavnani5-Oct-02 8:41 
GeneralRe: Adding tabs to a CTabCrtl Pin
Daniel Strigl2-Oct-02 10:40
Daniel Strigl2-Oct-02 10:40 
GeneralRe: Adding tabs to a CTabCrtl Pin
Ravi Bhavnani2-Oct-02 10:54
professionalRavi Bhavnani2-Oct-02 10:54 
GeneralRe: Adding tabs to a CTabCrtl Pin
Daniel Strigl2-Oct-02 19:17
Daniel Strigl2-Oct-02 19:17 
GeneralRe: Adding tabs to a CTabCrtl Pin
Ravi Bhavnani3-Oct-02 5:01
professionalRavi Bhavnani3-Oct-02 5:01 
Questionwhy i print out nothing? Pin
wangnanjing30-Sep-02 16:25
wangnanjing30-Sep-02 16:25 
AnswerRe: why i print out nothing? Pin
Chris Losinger30-Sep-02 16:27
professionalChris Losinger30-Sep-02 16:27 
GeneralPointer Elements & STL Containers :: STL Pin
valikac30-Sep-02 15:53
valikac30-Sep-02 15:53 
GeneralRe: Pointer Elements & STL Containers :: STL Pin
Chris Losinger30-Sep-02 16:24
professionalChris Losinger30-Sep-02 16:24 
GeneralRe: Pointer Elements & STL Containers :: STL Pin
RedZenBird30-Sep-02 17:46
RedZenBird30-Sep-02 17:46 
GeneralRe: Pointer Elements & STL Containers :: STL Pin
valikac30-Sep-02 18:00
valikac30-Sep-02 18:00 
GeneralString String! Pin
sherry_ca30-Sep-02 15:39
sherry_ca30-Sep-02 15:39 
GeneralRe: String String! Pin
Chris Losinger30-Sep-02 16:26
professionalChris Losinger30-Sep-02 16:26 
GeneralRe: String String! Pin
sherry_ca30-Sep-02 16:58
sherry_ca30-Sep-02 16:58 

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.