|
Hi using this project for checkable group box option.Am not able to do Step 2.(Add a member variable for this added group box, but choose CCheckableGroupBox as control type. )
Pl help out this
|
|
|
|
|
Hello,
if i add manifest to show XP gui style, the radio button will not show correct.
Why ?
Any solution.
Jimmy
|
|
|
|
|
Anyone know how to get a CCheckableGroupBox to send notifications to the parent? I need to add a tooltip to one but it does not have the SS_NOTIFY style and I can't figure out how/where to set it.
--
Synetech
|
|
|
|
|
I want to set the text colour so that its the same colour as other group boxes in XP.
I tried using adapting http://www.codeproject.com/staticctrl/coloredit_colorstatic.asp
for buttons. This allows the background colour to be set but the text colour doesn't change.
|
|
|
|
|
I changed in this way:
So the text is drawn by the groupbox, and the checkbox consists only of the box.
The Checkbox is always right of the text.
Has anybody a better solution?
Especially on propertypages the standard of CCheckableGroupBox doesn't look fine with themes enabled.
void CCheckableGroupBox::SetTitleStyle(UINT style)
{
CString strText;
CRect rc;
GetWindowText(strText);
TransStr(strText);
CClientDC dc(this);
CFont* pOldFont = dc.SelectObject(GetFont());
CSize czText = dc.GetTextExtent(strText);
dc.SelectObject(pOldFont);
if (IsAppThemed()) // Manifest
{
strText="";
GetWindowRect(rc);
this->ScreenToClient(rc);
rc.top-=1;
rc.left += czText.cx+12;
rc.right = rc.left+15;
rc.bottom = rc.top+15;
}
else
{
// Add some space for the checkbox and at the end
czText.cx += 25;
// Move the checkbox on top of the groupbox
GetWindowRect(rc);
this->ScreenToClient(rc);
// GetParent()->ScreenToClient(rc);
rc.left += 5;
rc.right = rc.left + czText.cx;
rc.bottom = rc.top + czText.cy;
}
|
|
|
|
|
i want to make gropbox control dynamically so which class and which style i have to use to make gropbox controll
like :
for creating button :class cbutton
Bankey Khandelwal
Software Engineer
|
|
|
|
|
Hi,
Your article help me to correct a bug in my application. Thank you ! I have a question for you. Why changing the style property of group box to icon or bitmap prevents overlapped text when tab is pressed. It was my bug...
Thank you
Sébastien
|
|
|
|
|
Hi,
I thought I'd post yet another extension to this wonderful class.
The class is great as it is but sometimes it's more desirable rather than enable or disable a group of controls to instead hide or show them.
I came up with this idea because I needed a way of allowing a user to toggle a large control on top of all other controls in a dialog. I needed a way of avoiding the controls beneath from being drawn over top of the big control when the mouse moves over them. I tried throwing a checkable groupbox around them and disabling and it worked. The problem was that when the dialog is minimized and restored, all the controls are drawn (disabled) before the big control is drawn, causing flicker. Also, beneath the big control were some controls which were disabled depending on some factors and when the big control was hidden and the controls beneath it enabled, all the controls were enabled instead of just the ones that should be.
I made a few changes to CCheckableGroupBox to include a flag which decides whether enabling/disabling it causes it's subcontrols to be enabled/disabled or hidden/show. Plus, when the controls are hidden, they automatically become disabled.
if(pT->GetGroupID() == m_nGroupID && pT != this) {
pT->SetCheck(0);
}
if(pT->GetGroupID() == m_nGroupID && pT != this) {
pT->SetCheck(0, m_CheckType);
}
pWnd->EnableWindow(nCheck==1&&m_TitleBox.IsWindowEnabled());
if (m_CheckType==CGB_ENABLE)
pWnd->EnableWindow(nCheck==1&&m_TitleBox.IsWindowEnabled());
else if (m_CheckType==CGB_VISIBLE)
pWnd->ShowWindow((nCheck==1&&m_TitleBox.IsWindowEnabled())?SW_SHOW:SW_HIDE);
void CCheckableGroupBox::SetCheck(int nCheck) {
if(::IsWindow(m_TitleBox.m_hWnd)) {
m_TitleBox.SetCheck(nCheck);
CheckGroupboxControls();
}
}
void CCheckableGroupBox::SetCheck(int nCheck, int checktype)
if(::IsWindow(m_TitleBox.m_hWnd)) {
m_TitleBox.SetCheck(nCheck);
m_CheckType=checktype;
CheckGroupboxControls();
}
}
void CCheckableGroupBox::SetCheckType(int checktype) {
m_CheckType=checktype;
}
int CCheckableGroupBox::GetCheckType() {
return m_CheckType;
}
#define CGB_ENABLE 0
#define CGB_VISIBLE 1
int m_CheckType;
void SetCheck(int nCheck);
void SetCheck(int nCheck, int checktype=CGB_ENABLE);
void SetCheckType(int checktype=CGB_ENABLE);
int GetCheckType();
I also commented out the sections dealing with mapChkableGroupWnds which handles subcontrols that are checkable boxes. I find that handling checkable box subcontrols causes a lot of trouble and ignoring them makes things much better.
Now you can use SetCheckType(CGB_VISIBLE) which will make calles to SetCheck(...) toggle visibility rather then enabled status. Alternately you can for example use SetCheck(BST_CHECKED, CGB_VISIBLE) to make all subcontrols visible and SetCheck(BST_UNCHECKED, CGB_VISIBLE) to make them invisible (and disabled).
Hope others find this extension useful.
--
Synetech
|
|
|
|
|
Hi,
This class is more useful than the even Ziming intended. If you have a dialog where you need to enable or disable a group of buttons based on user input this class can make it easy. For example, I've got a dialog app which can allow the user to do stuff in a few different modes. There are a few controls that are used in all modes, and each mode has a few exclusive controls. What I did was to put a group box around each set of controls and assigned a CCheckableGroupBox to them, some of the group boxes are visible, some are hidden. Now when the user clicks a radio button to select the mode, I set or clear the group box to quickly and easily enable or disable that group of controls using SetCheck.
This is great. There's just a couple of things that need to be done differently, first, I had to modify the the SetTitleStyle method:
<small>if(style == BS_AUTOCHECKBOX || style == BS_AUTORADIOBUTTON || style == BS_AUTO3STATE) {<br />
m_TitleBox.Create(strText, style | WS_CHILD , rc, this, ID_TITLE);<br />
m_TitleBox.SetFont(GetFont(), true);<br />
m_TitleBox.ShowWindow(SW_SHOW);<br />
}</small><br />
<big> else<br />
m_TitleBox.Create(strText, BS_AUTOCHECKBOX | WS_CHILD , rc, this, ID_TITLE);<br />
</big>
Next, I used [m_Group_Color].SetTitleStyle(0); That's it. It works beautifully.
Nice work Ziming, it's amazing how easy it is to extend your great class.
--
Synetech
|
|
|
|
|
Hi,
This is a very good class (no bug reports! ). But I want it to allow a 3state checkbox so I changed this single line to SetTitleStyle():
from
if(style == BS_AUTOCHECKBOX || style == BS_AUTORADIOBUTTON)
to
if(style == BS_AUTOCHECKBOX || style == BS_AUTORADIOBUTTON || style == BS_AUTO3STATE)
Now, it disables the contained controls when the checkbox is disabled or indeterminate, and enables them when it is enabled. And, doing a GetCheck on the groupbox control returns the expected values (BST_CHECKED/BST_UNCHECKED/BST_INDETERMINATE).
EASY change.
--
Synetech
|
|
|
|
|
1. Change return type of GetGroupID to UINT
2. Simply code to handle check and radio style only. Or just display normal group box.
|
|
|
|
|
Why is it that every time someone goes to run your sample, he/she is prompted to build the application, even when no code change was made?
It happens EVERY TIME!!
William
Fortes in fide et opere!
|
|
|
|
|
Sorry! I cannot regenerate it on my machine. Can you use the class?
Ziming Wang
|
|
|
|
|
The program runs fine, and I see what you do. It's just that every time I go to run the application, it tells me that I need to rebuild it because files may be missing or out of date. EVERY TIME!!
It doesn't matter if I made no change to the code, it still tells me I need to rebuild the program. If I reply, "No" to the prompt, the application runs fine.
Its the prompt to which I'm referring that comes up every time.
William
Fortes in fide et opere!
|
|
|
|
|
Make sure that files on the machine have the correct date (i.e. not in the future) if they do find some kind of "touch" utility to correct their timestamp (by the way check all three create/mod/access)
|
|
|
|
|
Thanks okigan! It seems make sense.;)
|
|
|
|
|
Considering I literally run at least a hundred different applications everyday on my machine and they don't behave the way this particular sample does, was what caught my attention. Immediately (like the very next second) I ran the sample again, and again it prompted with the same message. At first I replied, "Yes," and it would rebuild the application, and subsequently run fine. Then, I would run it again (immediately), and again it would do the same prompt. This time I replied, "No," but it didn't matter because it ran fine anyway.
Still again, I ran it once more, and again it prompted me to rebuild. Again I replied, "No," and again it ran fine.
That's what happening, and it's ONLY happening to this sample even though I've made no change to the code.
What "create," "mod," and "access" are you talking about that I should check?
William
Fortes in fide et opere!
|
|
|
|
|
When you stated that the timestamp must be current (i.e. not in the future), I checked to see if any of the files I was using had a future timestamp, AND SOME DO (including the 'workspace' file which I downloaded and ran the way I got it, without making any change to it).
Currently, the time my computer is showing is about 6:30 a.m. Pacific time in the United States. Some of the files I downloaded are showing the same date, but nearly 9:00 a.m., which has NOT occurred yet for us in the Western United States.
I believe if I were to run the sample AFTER 9:00 a.m., I won't have the same situation to deal with.
Thanks!!
William
Fortes in fide et opere!
|
|
|
|
|
Williamsoy
Que pasa c on usted ahorahita o ahoraita. Pero, Que estaen las topdos.<a href=""></a>Yort 
|
|
|
|
|
|
I used to have this same problem with several projects. I saw this post a while back and checked the timestamps as you suggested and bingo, problem solved. Thanks a lot.
--
Synetech
|
|
|
|
|
Hi William,
I even tried it on separate window machine, and still can not get the prompt you are talking about. Perhaps it is due to some settings on your machine?
And more, I have updated the doc and demo project to support radio button
title for group box, and so is the screen shot. Maybe you will like to
check out the latest one and try it again?
Thank you very much!
Ziming Wang
|
|
|
|
|
The reason the compiler keeps asking you to recompile everything is because the date/time stamp on the various project files is newer than the current date/time on your computer. As a result, whenever the compiler builds the binaries it gives them each a date/time stamp that is older than the one on the corresponding source file.
The problem is easily fixed by running a touch utility on the source files. (Check Google for a download.) Ziming doesn't see the problem becuase his clock is set differently than yours.
Martin C Cook
Who needs cyberspace when you have CP space?
|
|
|
|
|
Oops, I see that okigan had already suggested touching the files. I guess I type too slow...
This is one of those problems that catches everyone sooner or later. Perhaps Microsoft will address the problem some day.
By the way Ziming, I like the control. It is a simple solution to a problem that we have all faced before. Please accept my compliments.
Martin C Cook
Who needs cyberspace when you have CP space?
|
|
|
|
|
After downloading the new ".dsp", ".dsw", ".h" and ".cpp" for the CheckableGroupBox files, I replaced the old files with the new ones, and rebuilt the entire application. However, what I got was the old version; not the new one with the radio buttons.
Short of wiping out everything and starting over from scratch, I believe the files I replaced ought to have worked. Any suggestion why they didn't?
William
Fortes in fide et opere!
|
|
|
|