Variable sized toolbar buttons

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
 
V

viveque.kumar

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
 
V

viveque.kumar

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
 
C

Christian ASTOR

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

viveque.kumar

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top