Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why does the BTNS_DROPDOWN style cause the whole toolbar to move down a couple pixels?

Tags:

c++

toolbar

mfc

I have a CToolbar and within it I have a button with style BTNS_BUTTON|BTNS_DROPDOWN. I would like to make it a split button, so the left side of the button is a button, and the right side has a drop down menu.

To complete this, I create the button then I call ::SendMessage like so:

::SendMessage( hwndForButton, TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_DRAWDDARROWS );

This works great and creates the split button, but also has the ill-effect of moving down the toolbar a couple pixels. If I don't send the message, then I still have the issue (and I don't have the split button anymore).

If I change the style of the button to BTNS_BUTTON|BTNS_WHOLEDROPDOWN then I don't have an issue, although I also don't have the split button.

Any clue as to what could be going wrong here? I figure there is a margin that is applied to a BNTS_DROPDOWN and it is causing the toolbar to move down.

like image 842
Jared Avatar asked Feb 10 '09 22:02

Jared


1 Answers

Well this question is very old indeed but since it appears at the very top of google results on the topic and for future reference browsing a little further it seems that there is one workaround (quoted from http://www.ureader.com/msg/1484852.aspx):

"Don't know why, but the problem rise when I set the the BTNS_DROPDOWN style from the beginning. I've if add the buttons without any of the set to BTNS_DROPWN and in the next line I use TB_SETBUTTONINFO to change the style, everything works fine."

like image 52
floyd73 Avatar answered Nov 15 '22 01:11

floyd73