Re: checkbox caption placement
- From: Joseph M. Newcomer <newcomer@xxxxxxxxxxxx>
- Date: Tue, 28 Nov 2006 19:47:12 -0500
No, not really There is no support for this.
You could create a static control with the caption, set the SS_NOTIFY style, and create a
check box with no caption at all Then you could respond to WM_LBUTTONDOWN events in the
caption by doing something like
void CMyButtonCaption::OnLButtonDown(...)
{
CWnd * buddy = GetWindow(GW_HWNDNEXT);
if(buddy == NULL)
return;
if(buddy->GetCheck() == BST_CHECKED)
buddy->SetCheck(BST_UNCHECKED);
else
buddy->SetCheck(BST_CHECKED);
}
In this case, I set it up so the next window in the Z-order is assumed to be the "buddy"
of the static control, so you would lay down the static control and then the checkbox, or
adjust the Z-order afterward. This also assumes the button is auto-2-state; generalizing
it to 3-state is an Exercise For The Reader.
There are subtler issues such as showing a focus rectangle, having it respond to a tab key
properly, etc.; in this case you would not use CStatic but a control derived from CWnd and
do a fancy OnPaint to handle this.
joe
On 28 Nov 2006 15:47:10 -0800, "mitenko" <mitenko@xxxxxxxxx> wrote:
Hi everyone, hope you're all well.Joseph M. Newcomer [MVP]
newbie question: I'm wondering if there's an easy way for setting up
checkboxes so that the caption text ends up above or below the actual
checkbox.
regards,
mitenko
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.
- Follow-Ups:
- Re: checkbox caption placement
- From: mitenko
- Re: checkbox caption placement
- References:
- checkbox caption placement
- From: mitenko
- checkbox caption placement
- Prev by Date: Re: Locale Explorer
- Next by Date: Re: Memory problems (possibly very easy question)
- Previous by thread: checkbox caption placement
- Next by thread: Re: checkbox caption placement
- Index(es):