And MFC property pages of the wizard page (CPropertyPage / CPropertySheet)

(Mark): class CPropertyPage object representation of each page of a property sheet, or a dialog box is seen as the label - taken from Baidu Encyclopedia

(Mark): CPropertyPage is inherited from a subclass of CWnd.

(Mark): Here are some important classes of member profiles CPropertyPage class:

1) Constructor

        Mentioned here three CProperty class constructor function prototype:

        CPropertyPage( );

        explicit CPropertyPage(
                UINT nIDTemplate,
                UINT nIDCaption = 0,
                DWORD dwSize = sizeof(PROPSHEETPAGE)
        );

        explicit CPropertyPage(
                LPCTSTR lpszTemplateName,
                UINT nIDCaption = 0,
                DWORD dwSize = sizeof(PROPSHEETPAGE)
        );

       The first is no constructor arguments.

       The second constructor parameter nIDTemplate is property page dialog resource ID, parameter nIDCaption is the title of the property page dialog tab of the string resource with ID, if set to 0, the tab title to use the property page the title of the dialog box resource.

       The third constructor parameter lpszTemplateName As dialog box resource property page name string, can not be NULL. Parameters nIDCaption above.

      (2) CancelToClose () function

       After a certain operation unrecoverable property page modal dialog property page, using CancelToClose () function "OK" button to the "Close" button, and disable the "Cancel" button. Function prototype is:

       void CancelToClose( );

      (3) SetModified () function

       Call this function to activate or deactivate the "Apply" button, the function prototype is:

       void SetModified(BOOL bChanged = TRUE);

      (4) overloads

       CPropertyPage class provides a number of message handlers to respond to various messages property page dialog box. We override these message processing function, you can customize the processing of the Property Pages dialog box operation. The overloaded message processing function comprising:

       OnApply: Processing property pages "Apply" button is clicked message
       OnCancel: Processing property pages "Cancel" button is clicked message
       OnKillActive: processing the current active property page message is switched, commonly used in data validation
       OnOK: Processing "OK" button properties page, "Apply" button or the "Close" button is clicked the message
       OnQueryCancel: message handling properties page "Cancel" button is clicked before the issue of
       onReset: processing properties page of the "Reset" button is click the message
       OnSetActive: processing properties page is switched to the currently active page news
       OnWizardBack: processing properties page of the "Back" button is clicked the message is valid only in the Wizard dialog box
       OnWizardFinish: processing properties page of the "Finish" button click the message is only valid in the Wizard dialog box
       OnWizardNext: processing properties page of the "Next" button is clicked the message is valid only in the Wizard dialog box

 

CPropertySheet attribute table class inherits from CWnd

CPropertySheet class inherits from CWnd class, which is the attribute table category, is responsible for loading, open or delete properties page, and you can switch property pages Property Pages dialog box. It is similar with the dialog box, there are modal and non-modal two kinds. The following Ji Zhuomi to explain part of the CPropertySheet class member functions.

      (1) Constructor

       There is still listed three constructors CPropertySheet class:

       CPropertySheet( );

       explicit CPropertySheet(
               UINT nIDCaption,
               CWnd* pParentWnd = NULL,
               UINT iSelectPage = 0
       );

       explicit CPropertySheet(
               LPCTSTR pszCaption,
               CWnd* pParentWnd = NULL,
               UINT iSelectPage = 0
       );

       Parameters nIDCaption: ID string resource title.

       Parameters pParentWnd: Property Pages dialog box of the parent window, if set to NULL, then the window for the parent application's main window.

       Parameters iSelectPage: the initial state, the active property page of the index, the default is first added to the property page property sheet.

       Parameters pszCaption: title string.

      (2) GetActiveIndex () function

       Gets the index of the currently active property page. Function prototype is:

       int GetActiveIndex( ) const;

       Returns: the index of the active property page.

      (3) GetActivePage () function

       Get the current active property page objects. Function prototype is:

       CPropertyPage* GetActivePage( ) const;

       Return value: pointer to the currently active property page object.

      (4) GetPage () function

       Gets a property page object. Function prototype is:

       CPropertyPage* GetPage(int nPage) const;

       Parameters nPage: index of the target property page.

       Return value: pointer to the target object's property page.

      (5) GetPageCount () function

       Gets the number of property pages. Function prototype is:

       int GetPageCount( ) const;

       Returns: the number of property pages.

      (6) GetPageIndex () function

       Acquiring a property in the Properties page index page dialog box. Function prototype is:

       int GetPageIndex(CPropertyPage* pPage);

       Parameters pPage: To obtain a pointer to the object property page of the index.

       Returns: the index in the property page object property page dialog box.

      (7) SetActivePage () function

       Setting a property page for the active property page. Function prototype is:   

       BOOL SetActivePage(
                 int nPage 
       );

       BOOL SetActivePage(
                 CPropertyPage* pPage 
       );

       Parameters nPage: To set the active property page of the index.

       Parameters pPage: To set the pointer to the object of active property page.

      (8) SetWizardButtons () function

       Enable or disable the Back, Next or Finish button on the Wizard dialog box, you should call this function before calling DoModal. Function prototype is:

       void SetWizardButtons(
                DWORD dwFlags 
       );

       Parameters dwFlags: Setup Wizard button appearance and functional properties. It may be a combination of the following values:

       PSWIZB_BACK enable the "Back" button if you do not include this value disables the "Back" button.
       PSWIZB_NEXT enable the "Next" button, if you do not include this value disables the "Next" button.
       PSWIZB_FINISH enable the "Finish" button.
       PSWIZB_DISABLEDFINISH display disabled "Finish" button.

      (9) SetWizardMode () function

       Settings Property Pages dialog box for the Wizard mode, this function should be called before calling DoModal. Function prototype is:

       void SetWizardMode( );

      (10) SetTitle () function

       Set Title Properties dialog box. Function prototype is:

       void SetTitle(
               LPCTSTR lpszText,
               UINT nStyle = 0 
       );

       Parameters lpszText: title string.

       Parameters nStyle: Specifies the title of the property sheet style. It should be 0 or PSH_PROPTITLE. If set PSH_PROPTITLE, the word "Properties" will appear after the specified title. For example, SetTitle ( "Simple", PSH_PROPTITLE) This call will make the property sheet titled "Simple Properties".

      (11) AddPage () function

       Add a new property page for the Properties dialog box. Function prototype is:

       void AddPage(
               CPropertyPage *pPage 
       );

       Parameters pPage: object pointer new property page to add.

      (12) PressButton () function

       Simulate pressing a designated button. Function prototype is:   

       void PressButton(
               int nButton 
       );

       Parameters nButton: To simulate the pressed button, it can be one of the following values:

       PSBTN_BACK select "Back" button. 
       PSBTN_NEXT Select "Next" button.
       PSBTN_FINISH Select "Finish" button.
       PSBTN_OK select "OK" button.
       PSBTN_APPLYNOW select "Apply" button.
       PSBTN_CANCEL select "Cancel" button.
       PSBTN_HELP select "Help" button.

      (13) RemovePage () function

       To delete a property page. Function prototype is:

       void RemovePage(
               CPropertyPage *pPage 
       );

       void RemovePage(
               int nPage 
       );

       Parameters pPage: To delete an object pointer property page.

       Parameters nPage: To remove a property page index

 

Illustration demonstrates a demo (wizard page):

1. Create an MFC Dialog Application

2 Insert two Dialog resources

 

 

ID are: IDD_PAGE1, IDD_PAGE2

3 is a new class object CPropertyPage two Dialog

 

 

 

 Note that base class selection: CPropertyPage

4 Create a subclass inherits from CPropertySheet in the class wizard, as CMySheet

 

 5 incorporated in the page header attributes CMySheet header files, and objects are defined two members.

 

 

 

 The associated property sheet. 6 CMySheet constructor class implementation file CMySheet two property pages.

 

 7 Dialog introduced in the Dlg class implementation file CMySheet class header file and add a button in the main Dialog, and add a click event. In the event handler, create CMySheet object and set the wizard mode and display page properties Wizard

 

Mark :

The difference between wizards and property pages General Properties page just SetWizardMode () function. Do not call this function displays are:

 

Guess you like

Origin www.cnblogs.com/emjx/p/12573261.html