Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

CToolBar buttons

0 views
Skip to first unread message

Peter Hirschberg

unread,
Oct 27, 1998, 3:00:00 AM10/27/98
to

I'm trying to make CToolBar buttons that stay pushed.

I've created them with the TBBS_CHECKBOX style, and that works,
but how can I manually Get or Set the state of the buttons
(pushed or not pushed) when I need to?


Thanks!
peter


rayk

unread,
Oct 27, 1998, 3:00:00 AM10/27/98
to
Hi Peter,

One method I've used, is 'SetButtonInfo(....)'. It deals with the
toolbar buttons,
and says...which button on the toolbar, what command, what style, and what
bitmap
image to put on the button.

//Change the apperance of toolbar connection button(my button)
CToolBar* pToolBar = (CToolBar*)
AfxGetApp()->m_pMainWnd->GetDescendantWindow(AFX_IDW_TOOLBAR);
pToolBar->SetButtonInfo(8,ID_FILE_CLOSE,TBBS_BUTTON,10);

Hope this helps,

Ray K.


Peter Hirschberg <pet...@REMOVEcronuscom.com> wrote in article
<714pju$gpb$1...@callisto.clark.net>...

Richard

unread,
Oct 27, 1998, 3:00:00 AM10/27/98
to

Peter Hirschberg wrote in message <714pju$gpb$1...@callisto.clark.net>...

>
>I'm trying to make CToolBar buttons that stay pushed.
>
>I've created them with the TBBS_CHECKBOX style, and that works,
>but how can I manually Get or Set the state of the buttons
>(pushed or not pushed) when I need to?
>


If you're using CToolBar, you should be able to get hold of the underlying
common control class CCToolBarCtrl using GetToolBarCtrl(). That has
functions for setting the state of buttons directly, e.g.
CToolBarCtrl::CheckButton..

Alternatively you can set the button states in their update UI handlers,
(e.g. pCmdUI->SetCheck...)

Joe Willcoxson

unread,
Oct 27, 1998, 3:00:00 AM10/27/98
to
The best way is to write an command UI update handler for your frame, view,
or doc that will call:

pCmdUI->Enable();
pCmdUI->SetCheck();

0 new messages