Re: Checked buttons on a toolbar
- From: "Tom Serface" <tserface@xxxxxxx>
- Date: Wed, 28 Dec 2005 08:04:53 -0800
The state of the button is set in the ON_UPDATE_COMMAND_UI call as you
suggest. If you have a variable that indicates the state for each button
you can change the variables for all other buttons when one is pressed...
for example:
void CMyApp::OnButton1()
{
m_bButton1 = true;
m_bButton2 = false;
m_bButton3 = false;
m_bButton4 = false;
}
// Do same for other buttons...
void CMyApp::OnUpdateButton1(CCmdUI *pCmdUI)
{
pCmdUI->SetCheck(m_bButton1?1:0);
}
void CMyApp::OnUpdateButton2(CCmdUI *pCmdUI)
{
pCmdUI->SetCheck(m_bButton2?1:0);
}
void CMyApp::OnUpdateButton3(CCmdUI *pCmdUI)
{
pCmdUI->SetCheck(m_bButton3?1:0);
}
void CMyApp::OnUpdateButton4(CCmdUI *pCmdUI)
{
pCmdUI->SetCheck(m_bButton4?1:0);
}
Tom
"Alex" <acamposr@xxxxxxxxx> wrote in message
news:1135550070.885053.252720@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>I want a toolbar in which only one button can be pushed or "checked" at
> the same time. I thought of unchecking every button unless the one
> clicked by the user. Is there any better way to do that (for example,
> ON_UPDATE_COMMAND_UI)?
>
.
- References:
- Checked buttons on a toolbar
- From: Alex
- Checked buttons on a toolbar
- Prev by Date: Re: CButton as toggle button
- Next by Date: Re: modeless dialog tooltips...
- Previous by thread: Re: Checked buttons on a toolbar
- Next by thread: MFC ActiveX Control May Flicker Excessively When it Is Overlapped By an IFRAME
- Index(es):
Relevant Pages
|