Click here to Skip to main content
15,914,066 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralPackage .exe file within .exe Pin
iluvyuri28-Jan-04 6:56
iluvyuri28-Jan-04 6:56 
GeneralRe: Package .exe file within .exe Pin
valikac28-Jan-04 7:51
valikac28-Jan-04 7:51 
GeneralRe: Package .exe file within .exe Pin
David Crow28-Jan-04 10:32
David Crow28-Jan-04 10:32 
GeneralRe: Package .exe file within .exe Pin
iluvyuri29-Jan-04 7:47
iluvyuri29-Jan-04 7:47 
GeneralRe: Package .exe file within .exe Pin
David Crow29-Jan-04 9:29
David Crow29-Jan-04 9:29 
GeneralRe: Package .exe file within .exe Pin
iluvyuri29-Jan-04 20:58
iluvyuri29-Jan-04 20:58 
GeneralRe: Package .exe file within .exe Pin
David Crow5-Feb-04 3:04
David Crow5-Feb-04 3:04 
GeneralCreating/Adding Tabs to a Tab Control Pin
monrobot1328-Jan-04 6:49
monrobot1328-Jan-04 6:49 
I'm looking to make a dialog based program that utilizes a tab control and I'm looking for the best way to go about this. Currently I have the main dialog with the tab control on it and I've created two child dialogs to add to the tab pages. This is how I add the pages, and switch between them in my code. To me it doesn't look like the best way to do things so I was hoping to get some ideas on a better way to go about this. Here is the code:
BOOL CDataManDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	m_tabData.InsertItem (0, " Media Sales ");
	m_tabData.InsertItem (1, " Price Information ");
	VERIFY (m_dlgSales.Create (IDD_MEDIASALES_DIALOG, this));
	VERIFY (m_dlgPrice.Create (IDD_PRICE_DIALOG, this));
	CRect rectCtrl;
	GetDlgItem (FRAME_TAB_DIALOG)->GetWindowRect (&rectCtrl);
	ScreenToClient (&rectCtrl);
	m_dlgSales.MoveWindow (&rectCtrl, TRUE);
	m_dlgSales.BringWindowToTop ();
	m_dlgSales.ShowWindow (SW_SHOW);
	m_dlgSales.SetFocus ();
		
	return FALSE;
}

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);
	m_dlgPrice.ShowWindow (SW_HIDE);

	// Get window of visible tabbed dialog.
	CWnd* pWndCurrentTab = NULL;
	switch (nCurrentTab) {
	case 0:
		pWndCurrentTab = &m_dlgSales;
		break;
	case 1:
		pWndCurrentTab = &m_dlgPrice;
		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;
}
One thing that really bothers me is I have to have a staic control on the form that is sized to the tab control - minus the tabs (FRAME_TAB_DIALOG) in order to have the child dialogs sized correctly. This doesn't seem like a good way to do things. Any help and/or ideas would be greatly appreciated. Thanks.

- monrobot13
GeneralRe: Creating/Adding Tabs to a Tab Control Pin
Carlos Antollini28-Jan-04 8:25
Carlos Antollini28-Jan-04 8:25 
GeneralRe: Creating/Adding Tabs to a Tab Control Pin
monrobot1328-Jan-04 12:02
monrobot1328-Jan-04 12:02 
GeneralCopy Constructors Pin
BrockVnm28-Jan-04 6:46
BrockVnm28-Jan-04 6:46 
GeneralRe: Copy Constructors Pin
peterchen28-Jan-04 7:13
peterchen28-Jan-04 7:13 
GeneralRe: Copy Constructors Pin
BrockVnm28-Jan-04 7:18
BrockVnm28-Jan-04 7:18 
GeneralRe: Copy Constructors Pin
peterchen28-Jan-04 7:42
peterchen28-Jan-04 7:42 
GeneralRe: Copy Constructors Pin
TFrancis28-Jan-04 7:43
TFrancis28-Jan-04 7:43 
GeneralRe: Copy Constructors Pin
Nitron28-Jan-04 7:16
Nitron28-Jan-04 7:16 
Generalstatistical mode Pin
act_x28-Jan-04 6:17
act_x28-Jan-04 6:17 
GeneralRe: statistical mode Pin
David Crow28-Jan-04 10:46
David Crow28-Jan-04 10:46 
GeneralRe: statistical mode Pin
act_x28-Jan-04 12:24
act_x28-Jan-04 12:24 
GeneralMFC and Windows 2000 Pin
Don Burton28-Jan-04 5:59
Don Burton28-Jan-04 5:59 
GeneralRe: MFC and Windows 2000 Pin
Anonymous29-Jan-04 5:34
Anonymous29-Jan-04 5:34 
GeneralSubclassing Problem Pin
Dennis L28-Jan-04 5:55
Dennis L28-Jan-04 5:55 
GeneralNot receiving Registered Broadcast Message Pin
Member 81460328-Jan-04 5:49
Member 81460328-Jan-04 5:49 
GeneralRe: Not receiving Registered Broadcast Message Pin
Diddy28-Jan-04 11:15
Diddy28-Jan-04 11:15 
GeneralRe: Not receiving Registered Broadcast Message Pin
Member 81460329-Jan-04 2:08
Member 81460329-Jan-04 2:08 

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.