CToolBar with two state buttons 
Author Message
 CToolBar with two state buttons

I have a toolbar that I've created in Developer Studio.  I want one of the
buttons on the toolbar to have two states (ie click it once and it
depresses, click it again and it pops back out).  Looking through the
documentation, it seems that I want to set the style TBSTYLE_CHECK when I
add the button to the toolbar.

What confuses me is that the default code generated by Developer Studio
calls m_wndToolBar.LoadToolBar(IDR_MAINFRAME) to load the toolbar which
doesn't allow me to specify TBSTYLE_CHECK.  It also seems that once
LoadToolbar() has been called, there is no way for me to dynamically change
this flag.

Am I overlooking something obvious?  Do I have to re-implement
LoadToolbar() myself just so that I can fiddle with the flags?

Mike



Fri, 11 Jun 1999 03:00:00 GMT  
 CToolBar with two state buttons

Hi Mike!
Listen (better : read) : I've done that many times by simply using
SetCheck() on the UPDATEUI handler. I don't know if this is the best
solution, but it does work well.

Ignacio.



Fri, 11 Jun 1999 03:00:00 GMT  
 CToolBar with two state buttons

Mike,
You could use:

         m_wndToolBar.SetButtonStyle(0,TBBS_CHECKBOX);

regards, Mike



Quote:
> ...  I want one of the buttons on the toolbar to have
>  two states (ie click it once and it
> depresses, click it again and it pops back out). ...

>  Developer Studio ... doesn't allow me to specify TBSTYLE_CHECK.

> Mike




Wed, 16 Jun 1999 03:00:00 GMT  
 CToolBar with two state buttons

Thanks for the tip.  I've got it running now.

Mike



Wed, 16 Jun 1999 03:00:00 GMT  
 CToolBar with two state buttons

Mike,
You could use:

         m_wndToolBar.SetButtonStyle(0,TBBS_CHECKBOX);

regards, Mike



Quote:
> ...  I want one of the buttons on the toolbar to have
>  two states (ie click it once and it
> depresses, click it again and it pops back out). ...

>  Developer Studio ... doesn't allow me to specify TBSTYLE_CHECK.

> Mike




Thu, 17 Jun 1999 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. CToolBar button click focus state problem

2. Creating two state button at runtime

3. Dialog Box two OK buttons, two Cancel buttons and TODO still on it

4. Saving and retrieving the state of toolbars CToolBar

5. CToolbar--How to set the HOT state?

6. saving CToolBar state

7. Saving CToolbar's state, Bug?

8. CToolBar selection state drawing problem!!

9. How to get a Two State check box in a DataGrid

10. Disabling a button of my CToolbar !!

11. ?CToolbar button customization problem

12. CToolbar: button names not showing during customization

 

 
Powered by phpBB® Forum Software