Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » How to make a groupbox with a checkbox for a label? Collapse All
Subject Author Date
Chris Thomas Aug 30, 2006 - 2:48 PM

Without Prof-UIS, in a regular windows app, I can make a groupbox with a checkbox label by deriving from CButton, put a CButton m_check member variable, and in the derived class

class CGroupCheckBox : public CButton
..
...

Chris Thomas Sep 1, 2006 - 8:38 AM

Thanks!

Chris Thomas Aug 30, 2006 - 2:57 PM

oh and thanks for any advice.

Chris Thomas Aug 30, 2006 - 2:55 PM

sorry I accidentially hit the Enter key...

class CGroupCheckBox : public CButton
...
CButton m_check;
...
};

and in CGroupCheckBox::PreSubclassWindow() create the m_check as a child of "this", and clear out the groupbox’s label.

And then I can implement CGroupCheckBox::OnCtlColor() and set m_check’s text color.

This all works great, until I tried to use CGroupCheckBox in a prof-uis app (on a prof-uis derived dialog). The OnCtlColor is being called but the color never takes effect. The goal is to make the text the same as the other prof-uis groupbox text color.

So then I redefined m_check to be CExtButton (keeping CGroupCheckBox as CButton derived). The checkbox is now a button, behaving like the BS_PUSHLIKE style is set. But I used Spy and the checkbox has the exact same style as other checkboxes on the same dialog. In addition, if I changed CGroupCheckBox to be CExtButton-derived, it too acts like a giant button.

How can I acheive my goal of having a checkbox for a groupbox label and 1) have the text color match the other prof-uis groupboxes (a light blue), and 2) have m_check’s WM_COMMANDs continue to be caught by it’s parent CGroupCheckBox (this is desirable because the handler automatically enables/disables all the controls contained within the groupbox, saving me work.

I could write a simple test program for you, but I figured this was pretty easy to whip up from scratch.

Technical Support Aug 31, 2006 - 8:34 AM

Here is a simple project which implements a group box with a check box.