Re: Checked buttons on a toolbar

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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


.



Relevant Pages

  • Re: force datagrid save?
    ... > I have a datgrid and when I click the toolbar or menu ... Tom T. ... Prev by Date: ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: XP style aware Menu?
    ... You need to create a manifest. ... Tom ... > I managed to get my toolbar xp style aware, but I can't get the menu to ... Prev by Date: ...
    (microsoft.public.vc.mfc)
  • Re: place toolbar on a dialog form
    ... Tom ... > toolbar in code on a dialog form but it is not getting displayed. ... > project is not an SDI/MDI project but a dialog one and thus doesn't have a ... Prev by Date: ...
    (microsoft.public.vc.mfc)
  • Re: Custom toolbars in Excel 2003
    ... Both are working for me Tom ... >> I wish to send a spreadsheet to colleagues with a custom toolbar attached. ... or do I have to load the toolbar onto individual machines. ...
    (microsoft.public.excel.programming)
  • Re: Looking for work in the Arkansas and Louisiana Area....
    ... do a sort on your cache and grab it from there though. ... Tom ... With the Skill Sets dialog open, ... > toolbar with the grabber on the far left and you can drag the toolbar ...
    (microsoft.public.dotnet.languages.vb)