Solved

CPropertySheet vs. CTabCtrl

Posted on 2000-02-28
3
1,308 Views
Last Modified: 2013-11-20
I'm making a new application..
I want the main window to be a Dialog, which consists of a CListCtrl, and a CPropertySheet (or CTabCtrl).

The Tab-window should consist of three different dialogs.

How do I do this?? Does anyone have some sample source??


Eks. of Dialog :

--------------------------------
|  ---------------------       |
|  | List              |       |
|  ---------------------       |
|  |                   |       |
|  |                   |       |
|  ---------------------       |
|                              |
|  ---- ---- ----              |
|  |D1| |D2| |D3|              |
|  |   ---------------------   |
|  |                       |   |
|  |                       |   |
|  |     Tab-Dialog 1      |   |
|  |                       |   |
|  |                       |   |
|  -------------------------   |
|                              |
--------------------------------
0
Comment
Question by:lar_jens
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 31

Accepted Solution

by:
Zoppo earned 280 total points
ID: 2565189
Hi lar_jens,

try it like this:

1. Create your dialog resource including the list and the tab control and add a picture control with id IDC_STATIC_DUMMY of wanted size and position of the child dialogs within the tab control and remove the 'Visible' style.

2. Create the three child dialogs with style 'Child', no border and no caption.

3. Create classes for these dialogs, e.g. CTabDlg, CMyDlg1, CMyDlg2, CMyDlg3.

4. In CTabDlg do following:
-add a CTabCtrl member for the tab control with ClassWizard, i.e. m_tab

// In header file CTabDlg.h
#include "MyDlg1.h"
#include "MyDlg2.h"
#include "MyDlg3.h"

class CTabDlg...
{
 ...
 CMyDlg1* m_pDlg1;
 CMyDlg2* m_pDlg2;
 CMyDlg3* m_pDlg3;

 void ShowChild( int id );
....
}

// In implementation file CTabDlg.cpp
// Override OnInitialUpdate()
BOOL CTabDlg::OnInitDialog()
{
 CDialog::OnInitDialog();
      
 // create new dialogs
 m_pDlg1 = new CMyDlg1;
 m_pDlg2 = new CMyDlg2;
 m_pDlg3 = new CMyDlg3;

 m_pDlg1->Create( CMyDlg1::IDD, this );
 m_pDlg2->Create( CMyDlg2::IDD, this );
 m_pDlg3->Create( CMyDlg3::IDD, this );

 // position childs
 CRect rect;
 GetDlgItem( IDC_STATIC_DUMMY )->GetWindowRect( rect );
 ScreenToClient( rect );

 m_pDlg1->MoveWindow( rect );
 m_pDlg2->MoveWindow( rect );
 m_pDlg3->MoveWindow( rect );

 // insert tab control items
 m_tab.InsertItem( 0, "Dialog 1" );
 m_tab.InsertItem( 1, "Dialog 2" );
 m_tab.InsertItem( 2, "Dialog 3" );

 ShowChild( 0 );
 return TRUE;
}

void CTabDlg::ShowChild( int id )
{
 m_pDlg1->ShowWindow( ( id == 0 ) ? SW_SHOW : SW_HIDE );
 m_pDlg2->ShowWindow( ( id == 1 ) ? SW_SHOW : SW_HIDE );
 m_pDlg3->ShowWindow( ( id == 2 ) ? SW_SHOW : SW_HIDE );
}

// add TCN_SELCHANGE notification message handler with ClassWizard
void CTabDlg::OnSelchangeTab1(NMHDR* pNMHDR, LRESULT* pResult)
{
 int id = m_tab.GetCurSel();

 ShowChild( id );

 *pResult = 0;
}

// cleanup
BOOL CTabDlg::DestroyWindow()
{
 m_pDlg1->DestroyWindow();      
 delete m_pDlg1;
 m_pDlg2->DestroyWindow();      
 delete m_pDlg2;
 m_pDlg3->DestroyWindow();      
 delete m_pDlg3;

 return CDialog::DestroyWindow();
}

handle child dialog's data exchange within overriden CTabDlg::OnOK() ...

hope that helps,

ZOPPO
0
 
LVL 1

Author Comment

by:lar_jens
ID: 2565536
Thnx..

I'm sorry but I haven't got the time to evaluate your answer, but it souds sain enough to me..

Thanks for the tip (right now, I'm trying another solution involving propertypages, but I'll get back to this one)...

0
 
LVL 31

Expert Comment

by:Zoppo
ID: 2565557
you're welcome    :)

you can take a look at http://www.codeproject.com/property/saprefs.asp, there you can find source code for making property sheet similar to i.e. netscape's options dialog (with the tree instead of the tab buttons). Perhaps this is a useful sample for you.

have a nice day,

ZOPPO
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Add content to output file 4 71
Perl Awk Need Help 3 139
while loop over for loop 7 116
Window placement 17 95
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question