Create a dialog box as VC5.0's Class Wizard ?

As you run Class Wizard in VC5.0, a dialog box with "Message Maps", "Member Variables" and other selective items is shown. When you click on these items, different listing items are shown on the same(?) dialog box.

I have an MFC application that needs the similar dialog box as its main interface. Would someone show me how to do it step by step on some key points?

{Assume two item bars (or buttons, or whatever) "A" and "B" on the dialog box. As "A" is clicked, two lists, list1 and list2, are shown on the box. As "B" is clicked, list1 and list2 are removed and list3 is shown.}
 
yingchunliAsked:
Who is Participating?
 
chensuConnect With a Mentor Commented:
That's called Property Sheets. There are documentations, details and samples in the Visual C++ Programmer's Guide.

Property Sheets: Overview
http://msdn.microsoft.com/library/devprods/vs6/visualc/vccore/_core_property_sheets.3a_.overview.htm
0
 
yingchunliAuthor Commented:
Thank you Chensu,

I am still not very clear on how to do it.

(1) what type of application I need to create first?(!!!)
(2) How to create the property dialog sheet?
(3) How Can I put the tabs on the (main?)dialog box?
(4) How the tabs are related to their corresponding sheets?
(5) How to add controls on each property sheet?

and so on.

Namely, I need details on some key points.

I hope and appreciate your further help.

 
0
 
chensuCommented:
I think the following articles answer your questions.

Creating a full application using the CPropertySheet
http://www.codeguru.com/propertysheet/creating_cprop_appl.shtml

Update: Creating a full application using the CPropertySheet
http://www.codeguru.com/propertysheet/upd_creating_cprop_appl.shtml

Feel free to ask further questions.
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

 
yingchunliAuthor Commented:
Hi! Chensu,

In the example, there are only two class definations and one line of code:
    TheApp MyApp;

I really wounder how it works (I know it works). Could you explain to me briefly?

What is the "Greek" after the dialogbox ID in "Resource"->"Dialog" part?

In addition, what type of application the example is? "Win32 Application"?

Thank you very much.


0
 
chensuCommented:
>In the example, there are only two class definations and one line of code:
>    TheApp MyApp;
>I really wounder how it works (I know it works). Could you explain to me briefly?

This is an extremely simple MFC program. I really don't know which lines of code you don't understand. MFC programs work like this way. Just take a look at the first several pages of any MFC tutorial books, then you should be able to understand how it works.


>What is the "Greek" after the dialogbox ID in "Resource"->"Dialog" part?

Open the FScript.rc as a text file and remove the following lines, which are for Greek language.

/////////////////////////////////////////////////////////////////////////////
// Greek resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ELL)
#ifdef _WIN32
LANGUAGE LANG_GREEK, SUBLANG_DEFAULT
#pragma code_page(1253)
#endif //_WIN32

....

#endif    // Greek resources
/////////////////////////////////////////////////////////////////////////////


>In addition, what type of application the example is? "Win32 Application"?

I guess you are saying which type you should choose when using AppWizard. You may choose "Win32 Application" and change the project settings to Using MFC. You may also choose MFC Dialog-based Application or any others too, then modify the code generated by AppWizard, delete unwanted source files, etc. There is not a type indeed. You can always create a project yourself without using AppWizard.
0
 
yingchunliAuthor Commented:
Chensu,

I have one more question at the current stage:

I have created an (dialog based) application with property sheet as a main window, and in the InitInstance() of the application class I have the following code:

      CMyPropSheet mySheet("Property Sheet", NULL, 0);
      m_pMainWnd = &mySheet;
      int nResponse = mySheet.DoModal();

On the property sheet, there are two property pages.  It works OK. BUt how can I make the property pages talk to each other?
(suppose there is an edit control on each of the property page, how can the content of the edit control in one page be assigned to the other edit control in the other page?)

Thaks.
0
 
chensuCommented:
In this case, you need to derive your own property page classes from CPropertyPage and override their constructor and CPropertyPage::OnSetActive/CPropertyPage::OnKillActive. Let's take the sample code at CodeGuru for the sake of convenience. Add a CString member variable m_strEdit to the CSheet class, which is used to share the string between the two property pages. Derive CPropertyPage1 and CPropertyPage2 from CPropertyPage. For example,


class CSheet;    // forward declaration

class CPropertyPage1 : public CPropertyPage
{
public:
    CSheet *m_pSheet;

    CPropertyPage1(CSheet *pSheet)
    {
        m_pSheet = pSheet;
    }
protected:
    virtual BOOL OnKillActive()
    {
        // Set m_pSheet.m_strEdit here
    }
};

class CPropertyPage2 : public CPropertyPage
{
public:
    CSheet *m_pSheet;

    CPropertyPage2(CSheet *pSheet)
    {
        m_pSheet = pSheet;
    }
protected:
    virtual BOOL OnSetActive()
    {
        // Get m_pSheet.m_strEdit here
    }
};


class CSheet : public CPropertySheet
{
public:
      
    CPropertyPage1 Page1;
    CPropertyPage2 Page2;
    CPropertyPage Page3;
    CPropertyPage Page4;
    CMenu  Menu;

    CSheet() : CPropertySheet( "Property Sheet Demo By Piperopoulos Panagiotis" ),
                   Page1(this), Page2(this)
    {

....

};
0
 
yingchunliAuthor Commented:
Thank you, chensu.
0
All Courses

From novice to tech pro — start learning today.