In article <MPG.232f93927ea5a1699897e9@news.free.fr>, sans@merci says...
In article <eiZl33bEJHA.4504@TK2MSFTNGP05.phx.gbl>, "Scott McPhillips
[MVP]" <org-dot-mvps-at-scottmcp> says...
There is a standard technique for inserting a control, such as a combo box,
into a toolbar. What you do is insert a separator into the toolbar (using
the resource editor, just slide the botton to the right a bit) where the
control will go. A separator is just a small gap between the buttons. Then
in code you can increase the width of the separator to make a wide enough
gap for the control. That is what the code in the link above is doing: It
calls CToolbar::SetButtonInfo to widen the separator. With this technique
all of the buttons to the right of the gap are automatically positioned.
Yes, Scott, thanks, but I believe it's what I already do during creation
of the toolbar : I modify the place holder button to be a
TBBS_SEPARATOR, then I create the combo-box at this place.
Here is the scrubbed code of my concerned function :
int CMyBar::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CToolBar::OnCreate(lpCreateStruct) == -1)
return -1;
if (!LoadToolBar(IDR_MYBAR))
return -1;
CRect rc;
SetButtonInfo(0, ID_COMBO, TBBS_SEPARATOR, 190);
GetItemRect(0, &rc);
rc. bottom = rc.top + 200;
m_Combo.Create(WS_CHILD | WS_VISIBLE | WS_VSCROLL |
CBS_DROPDOWNLIST | CBS_SORT, rc, this, ID_COMBO);
return 0;
}
And with this, the combo is at left side as foreseed, but the next
button at its right is invisible, because overlapped.
What's wrong in my code above ?
Tips about VC++", but I've not it under the hand here and now.