Click here to Skip to main content
15,895,011 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalbitmap on a dialog Pin
kapil Patry30-Sep-02 17:16
kapil Patry30-Sep-02 17:16 
GeneralRe: bitmap on a dialog Pin
Christian Graus30-Sep-02 17:43
protectorChristian Graus30-Sep-02 17:43 
GeneralAdding tabs to a CTabCrtl Pin
monrobot1330-Sep-02 16:30
monrobot1330-Sep-02 16:30 
GeneralRe: Adding tabs to a CTabCrtl Pin
Ravi Bhavnani30-Sep-02 17:07
professionalRavi Bhavnani30-Sep-02 17:07 
GeneralRe: Adding tabs to a CTabCrtl Pin
Daniel Strigl30-Sep-02 19:58
Daniel Strigl30-Sep-02 19:58 
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 
Here's the fragment I emailed you - hotmail mail has recently been bouncing and I wasn't sure if you'd get my reply.

CDlgHolding represents a tabbed dialog that can display 3 types of holdings (stock, cash and margin debt). Each type is represented by a modeless dialog. CDlgHolding contains a tab control, creates the modeless dialogs, and shows the appropriate one based on the user's selection. Here's a screenshot[^].

/////////////////////////////////////////////////////////////////////////////
// CDlgHolding dialog
 
BEGIN_MESSAGE_MAP(CDlgHolding, CDialog)
	//{{AFX_MSG_MAP(CDlgHolding)
	ON_NOTIFY(TCN_SELCHANGE, TAB_CTRL, OnTabSelected)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()
 
/////////////////////////////////////////////////////////////////////////////
// CDlgHolding message handlers
 
BOOL CDlgHolding::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
  // Initialize tab control
  CTabCtrl* pTabCtrl = (CTabCtrl *) GetDlgItem (TAB_CTRL);
  ASSERT (pTabCtrl != NULL);
  pTabCtrl->InsertItem (0, " Stock Holding ");
  pTabCtrl->InsertItem (1, " Cash Holding ");
  pTabCtrl->InsertItem (2, " Margin Debt ");
 
  // Create tabbed dialogs
  VERIFY (m_dlgStockHolding.Create (IDD_STOCK_HOLDING, this));
  VERIFY (m_dlgCashHolding.Create (IDD_CASH_HOLDING, this));
  VERIFY (m_dlgMarginHolding.Create (IDD_MARGIN_HOLDING, this));
  updateTabSelection();
 
  // Set focus to default tab
  m_dlgStockHolding.SetFocus();

  return FALSE; // return TRUE unless you set the focus to a control
                // EXCEPTION: OCX Property Pages should return FALSE
}
 
void CDlgHolding::OnTabSelected
  (NMHDR* pNMHDR, LRESULT* pResult) 
{
  // Set new current tab
  CTabCtrl* pTabCtrl = (CTabCtrl *) GetDlgItem (TAB_CTRL);
  ASSERT (pTabCtrl != NULL);
  long nCurrentTab = pTabCtrl->GetCurSel();
 
  // Hide all tabbed dialogs
  m_dlgStockHolding.ShowWindow (SW_HIDE);
  m_dlgCashHolding.ShowWindow (SW_HIDE);
  m_dlgMarginHolding.ShowWindow (SW_HIDE);
 
  // Get window of visible tabbed dialog
  CWnd* pWndCurrentTab = NULL;
  switch (nCurrentTab) {
    case 0:
      pWndCurrentTab = &m_dlgStockHolding;
      break;
    case 1:
      pWndCurrentTab = &m_dlgCashHolding;
      break;
    case 2:
      pWndCurrentTab = &m_dlgMarginHolding;
      break;
    default:
      ASSERT (FALSE);
      break;
  }
 
  // Resize and show 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();
  }
 
  // Return normally
	*pResult = 0;
}
 
// End DlgHolding.cpp
Hope this helps!

/ravi

Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
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 
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 

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.