Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

modeless propertysheet with OK and Cancel?

Posted on 2000-04-06
4
Medium Priority
?
507 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 225 total points
ID: 2691001
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
ID: 2691743
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
ID: 2692157
Instead of a modeless propertysheet with buttons, try creating a modal propertysheet in its own UI thread.
0
 

Author Comment

by:searching
ID: 2699451
mnewton also thank you for the tips
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
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.
Suggested Courses

971 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