Solved

modeless propertysheet with OK and Cancel?

Posted on 2000-04-06
4
464 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
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
function returning CString in a regular win32 DLL 8 190
format the code in java 6 102
conditional code and condition difference 9 84
sumHeights  challenge 17 75
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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…

830 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