Print Page | Close Window

Buttons missing in modeless CXTResizePropertySheet

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=11128
Printed Date: 15 November 2025 at 6:42am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Buttons missing in modeless CXTResizePropertySheet
Posted By: luinho
Subject: Buttons missing in modeless CXTResizePropertySheet
Date Posted: 20 June 2008 at 11:23am
It looks like this is a bug in the MFC CPropertySheet class itself that does not create the buttons when the propertysheet is modeless (I don't exactly know why someone would not need the buttons just because the dialog is modeless... ), but I would expect the derived CXTResizePropertySheet to be implemented properly and fix this "bug".
Anyway, is there an easy way to create a resizeable modeless property sheet with the OK, CANCEL and HELP buttons using CXTResizePropertySheet ?



Replies:
Posted By: Oleg
Date Posted: 20 June 2008 at 1:38pm
Use Google + "How To Create a Modeless CPropertySheet with Standard Buttons"

-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: luinho
Date Posted: 23 June 2008 at 5:47am
Many thanks Oleg.
 
I got this from the MSDN article
Q146916 - How To Create a Modeless CPropertySheet with Standard Buttons
 

For a modeless CPropertySheet, the Microsoft Foundation Classes (MFC) resize the sheet and hide the standard buttons in the CPropertySheet::OnInitDialog member function. To prevent MFC from doing this, perform the following steps:

Derive a class from CPropertySheet and override the OnInitDialog function.

Set "m_bModeless" to FALSE and remove the WF_CONTINUEMODAL style for "m_nFlags".

Call CPropertySheet::OnInitDialog.

Set "m_bModeless" back to TRUE and add the style WF_CONTINUEMODAL to "m_nFlags".

BOOL CMyPropertySheetClass::OnInitDialog()

{

      BOOL bResult;

      if(this->m_bModal)

      {

            bResult = CPropertySheet::OnInitDialog();

      }

      else

      {

            m_bModeless = FALSE;  

            m_nFlags |= WF_CONTINUEMODAL;

 

            bResult = CPropertySheet::OnInitDialog();

 

            m_bModeless = TRUE;

            m_nFlags &= ~WF_CONTINUEMODAL;

      }

 

return bResult;

}

In addition, if you want to ommit the Aply button, use this in the constructor of the derived property sheet class:

 

      // We don't want to display the apply button

      this->m_psh.dwFlags |= PSH_NOAPPLYNOW;




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net