Solved

modeless propertysheet with OK and Cancel?

Posted on 2000-04-06
4
472 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 

Accepted Solution

by:
cbursk earned 75 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
while loop over for loop 7 119
changeXy challenge 13 96
Way to decrease size of apk file 9 131
I could not set window to top 4 62
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

737 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