Solved

modeless propertysheet with OK and Cancel?

Posted on 2000-04-06
4
432 Views
Last Modified: 2013-11-20
How do I create a modeless property sheet with OK and Cancel buttons?

I've tried it the following way but my property sheet doesn't has OK and Cancel buttons (probably some style flag to set I suppose?)

class CMainFrame {
CMyPropertySheet m_ps;
...
}

CMainFrame::CMainFrame()
:m_ps(_T("Properties"))
{
}

CMyPropertySheet::CMyPropertySheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
:CPropertySheet(pszCaption, pParentWnd, iSelectPage)
{
  AddPage(&m_myPage);
}
void CMainFrame::OnShowProps()
{
  m_ps.Create(this);
}
0
Comment
Question by:searching
4 Comments
 

Accepted Solution

by:
cbursk earned 75 total points
Comment Utility
I'm assuming that you are using Microsoft Visual Studio.

According to the Microsoft help files:
"Modeless property sheets displayed with a call to Create do not have OK, Cancel, Apply Now, and Help buttons as modal property sheets do. Desired buttons must be created by the user."

I'm assuming that the page you added is a CPropertyPage derived class that is attached to its own dialog resource.  You will need to create your own buttons ( probably using the resource editor in Visual Studio ) and then map each button ( you can use the class wizard ) to your property page's class code to do whatever you want to based on whether the user pressed the Ok or Cancel button.
0
 
LVL 3

Expert Comment

by:mnewton022700
Comment Utility
I have created a modeless property sheet, complete with buttons, before. I did it by creating the buttons in the OnCreate method of my property sheet and then moving them to where I wanted them to be in the OnInitialUpdate method of the property sheet.

I created them in OnCreate so that the tabbing order was correct.

In the handler methods for the buttons you can simulate the modal buttons by calling PressButton. For example in the OnOK handler you can call "PressButton(PSBTN_OK);"

Another hint is that you should set the font of each button to GetTabControl()->GetFont(). Otherwise they will look ugly.

Hope this helps.

0
 
LVL 10

Expert Comment

by:RONSLOW
Comment Utility
Instead of a modeless propertysheet with buttons, try creating a modal propertysheet in its own UI thread.
0
 

Author Comment

by:searching
Comment Utility
mnewton also thank you for the tips
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Turn a spreadsheet into a vba executable. 2 66
Expand macro to ask for filename column 8 34
iSeries DB2 Query 2 83
bigDiff challenge 17 74
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now