Discussion:
Variable sized toolbar buttons
(too old to reply)
v***@gmail.com
2006-06-02 10:20:18 UTC
Permalink
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
Kellie Fitton
2006-06-02 14:59:09 UTC
Permalink
Hi,

The help file on MSDN has the following remarks:

"The size can be set only before adding any buttons to the toolbar".

So, set the size before inserting the buttons into the toolbar.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/toolbar/messages/tb_setbuttonsize.asp

Kellie.
v***@gmail.com
2006-06-05 05:17:10 UTC
Permalink
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
Post by Kellie Fitton
Hi,
"The size can be set only before adding any buttons to the toolbar".
So, set the size before inserting the buttons into the toolbar.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/toolbar/messages/tb_setbuttonsize.asp
Kellie.
Christian ASTOR
2006-06-05 06:40:36 UTC
Permalink
Post by v***@gmail.com
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 ?
v***@gmail.com
2006-06-05 12:53:25 UTC
Permalink
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
Post by Christian ASTOR
Post by v***@gmail.com
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 ?
v***@gmail.com
2006-06-05 05:17:37 UTC
Permalink
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
Post by Kellie Fitton
Hi,
"The size can be set only before adding any buttons to the toolbar".
So, set the size before inserting the buttons into the toolbar.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/toolbar/messages/tb_setbuttonsize.asp
Kellie.
Continue reading on narkive:
Loading...