Ciao!
Jim Shaw
Jörg Meyer <mey...@werum.de> wrote in article <337854...@werum.de>...
> Hi,
>
> I want to add additional buttons in the bottom of a
> property-sheet-dialog (with tabs), but there is only the possibility
> to change the text of the 'finish'-button.
>
> Does anyone know about the problem?
>
> Thanks,
> Joerg
>
I did exactly this - make a modeless CPropertySheet a child of a
dialog - and now have the problem, that the app *hangs* completely,
when the following happens:
The app looses focus to another app while one of the controls on one of
the property pages has focus.
Apart from this problem everything works fine. Do you have any idea
what I have to tweak to get rid of this final problem?
Thanks for any pointers...Hans
Joerg,
You might find some help in Knowledge Base article Q143210 "How to Add
the Finish Button to a Wizard Property Sheet". It's not quite what you
asked, but it should be easy enough to extend its general idea into
creating additional buttons.
Dave
----
Address is altered to discourage junk mail.
Remove ".---" for the real address.
Hans
I did this by overriding the sheet's OnInitDialog. The things to do there:
1. Add CButton data members to your sheet, one for each new button.
2. Call the base class' OnInitDialog, this positions the other controls
appropriately.
3. Create your extra buttons programmatically (with Create).
I copied Cancel button's diameter to my new buttons, got the space between
the buttons by calculating the distancies between the default buttons, and
copied the font from one of the predefined buttons. Because I positioned my
buttons on the left, I also needed the offset to the sheet's edge. I got this
by calculating the distance from the help button's right edge to the sheet's
right edge.
You can get pointers to the default buttons by calling GetDlgItem with
IDCANCEL, IDOK, IDHELP, ...
--
--
Heikki Toivonen Phones in order of preference:
Email: hj...@cc.jyu.fi Home: +358 14 245 008
WWW: http://www.jyu.fi/~hjtoi Mobile: +358 40 5212 017
Hi Hans -
I assume you made derived a new class from CPropertySheet? I did the exact
same thing a while back for embedding tabbed dialogs inside other windows,
works great. I never saw the problem you describe. This is what I did in my
derived class:
int CDmSheet::DoModal()
{
return IDCANCEL;
}
BOOL CDmSheet::Create(CWnd* pParentWnd, DWORD dwStyle, DWORD dwExStyle)
{
return CPropertySheet::Create(pParentWnd, dwStyle, dwExStyle);
}
BOOL CDmSheet::OnInitDialog()
{
CPropertySheet::OnInitDialog();
CRect rcSheet;
CWnd* pOldParent = GetParent();
CWnd* pNewParent = pOldParent->GetParent();
pOldParent->GetWindowRect(&rcSheet);
pNewParent->ScreenToClient(&rcSheet);
SetParent(pNewParent);
SetWindowPos(pNewParent, rcSheet.left, rcSheet.top, rcSheet.Width(),
rcSheet.Height(), SWP_NOZORDER | SWP_SHOWWINDOW);
ModifyStyle(0, DS_CONTROL, 0);
ModifyStyleEx(0, WS_EX_CONTROLPARENT, 0);
return TRUE;
}
Then I put a CDmSheet(name of my property sheet class) member variable in
my Dialog class. In the Dialog OnInitDialog I did this:
m_Sheet.Create(GetDlgItem(IDC_SHEET), WS_CHILD);
IDC_SHEET being a static frame that I use for sizing the embedded property
sheet. After this I was able to treat it just liek any other property
sheet. Hope this helps-
-Craig
Like Katy said you can create a button dynamically in the OnInitDialog of
the PropertySheet class by calling a CButton object's Create member
function. I had some difficulties with moving the default buttons around to
make space but actually adding the button and manually inserting a message
handler for it is not too hard.
-Craig
Applying the WS_EX_CONTROLPARENT style did it in my case.
Cheers...Hans