Variable sized toolbar buttons

  • Thread starter Thread starter viveque.kumar
  • Start date Start date
V

viveque.kumar

Hi,

I have a toolbar which I create using CreateWindowEx using specifying

TOOLBARCLASSNAME as the class name and the following styles:

WS_CHILD | WS_CLIPSIBLINGS | CCS_TOP | CCS_NORESIZE | CCS_ADJUSTABLE |
CCS_NODIVIDER | TBSTYLE_FLAT | TBSTYLE_CUSTOMERASE | TBSTYLE_LIST

I insert the buttons one by one into the toolbar using the following
messages:

::SendMessage (m_hWnd, TB_INSERTBUTTON, iButton, (LPARAM) (TBBUTTON*)
pItem
::SendMessage (m_hWnd, TB_SETBUTTONSIZE, 0, (LPARAM) MAKELONG
(110,22));

I want that my last button be of variable width and prefer that it
occupy the entire client area of the toolbar left instead of the
standard size mentioned above.

I have tried all kinds of combinations (WM_AUTOSIZE, values of
DESKBANDINFO)
but the button size just doesnt seem to deviate.

The button doesn't have any menu or image or anything, just a small
length of text.
Can anyone help me here??

Thanks,
- Vivek
 
I have done that, it again sets the size of the button which is
followed throughout for all the buttons. If i set some size lets say
(100,25) initially then all the buttons take the same size.

My need is to keep my some buttons of variable size, e.g. the last one
to be of bigger size than the rest...

- Vivek
 
I have done that, it again sets the size of the button which is
followed throughout for all the buttons. If i set some size lets say
(100,25) initially then all the buttons take the same size.

My need is to keep my some buttons of variable size, e.g. the last one
to be of bigger size than the rest...

- Vivek
 
I have done that, it again sets the size of the button which is
followed throughout for all the buttons. If i set some size lets say
(100,25) initially then all the buttons take the same size.

My need is to keep my some buttons of variable size, e.g. the last one
to be of bigger size than the rest...

Have you tried TB_SETBUTTONINFO ?
 
Yeah I tried TB_SETBUTTONINFO and it worked perfectly.
Until now I was using TB_SETBUTONSIZE for sizing of the same.

Using TB_SETBUTTONINFO also solved another problem of mine which was
giving me nightmares. Upon any activity which was generating
WM_SETTINGCHANGE mesages my toolbar was getting shrunk to less than
half it's size, now it doesn't :)

Thanks guys,
- Vivek
 
Back
Top