Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Buttons in PropertySheet

99 views
Skip to first unread message

Jim shaw

unread,
May 14, 1997, 3:00:00 AM5/14/97
to

I don't believe that you can add extra buttons to the property sheet/
pages.
You may have to create your own dialog with a tab control and add the
buttons there.

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
>

Hans Brucker

unread,
May 14, 1997, 3:00:00 AM5/14/97
to

Hi Jim!

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

h...@anubia.com

David Lowndes

unread,
May 15, 1997, 3:00:00 AM5/15/97
to

>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.

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.

Simon Martin

unread,
May 15, 1997, 3:00:00 AM5/15/97
to

I did this by overloading the CreateStandardButtons in the MFC source. You
have to recompile the corresponding libraries to get it to work correctly
(recompile using the DOS utilities).


Hans Brucker

unread,
May 15, 1997, 3:00:00 AM5/15/97
to

Thanks Douglas, this could be the right track...will try it as soon as
I return from travelling next week ...

Hans


Heikki Toivonen

unread,
May 16, 1997, 3:00:00 AM5/16/97
to

In article <337854...@werum.de>, Jörg Meyer <mey...@werum.de> wrote:
> 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.

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

Craig Boulton

unread,
May 20, 1997, 3:00:00 AM5/20/97
to

Hans Brucker wrote in article ...

>Hi Jim!
>
>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.
>

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


Craig Boulton

unread,
May 20, 1997, 3:00:00 AM5/20/97
to

>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?

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

Hans Brucker

unread,
May 24, 1997, 3:00:00 AM5/24/97
to

>> I ran into something similar to what you're describing. I have a
>> property sheet that is a child of a property page (nested tabs).
>> Anyway, when one of the nested controls had focus and I tried
>> changing to an 'uncle' tab, the software would hang.

Thanks Doug,

Applying the WS_EX_CONTROLPARENT style did it in my case.

Cheers...Hans

0 new messages