 |
|
 |
I am afraid must monitor the parent resizing
|
|
|
|
 |
|
 |
But when i resize the bar (floating), combobox disappears.
|
|
|
|
 |
|
 |
Hi All,
First thanks and congratulations for this code.
For me it works fine in VC++ 6.0, I have a Combo in the toolbar. But when I updated my dialog application to VC++ 7.1, ComboBox appears ok, but the toolbar buttons are taller than the "normal" toolbar button, causing all buttons to become cut off at the bottom of the toolbar itself.
Can anyone help me?, thanks in advance.
Thanks a lot.
Csavi.
|
|
|
|
 |
|
|
 |
|
 |
Hello
I have a toolbar that one of the buttons has a drop-down / floating menu (the dialog of CFileDialog for example) - how can I get a handle to that menu?
Thanks
Alex
|
|
|
|
 |
|
 |
Well, this code works perfectly for 16x16 toolbar buttons, but you see the ugly separator if the buttons are let's say 32x32. Any ideas on how to fix that?
|
|
|
|
 |
|
 |
unfortunately.. I tried a lot and then gave up and removed the ListCntrl from the tool bar. I wanted to show the toolbar with text on buttons along with icon. even with 16*16 it doesn't show seperator properly in that case.
verinder
verinder
|
|
|
|
 |
|
 |
Well, nobody answers positively on my question, so now I do think that it is impossible to use this technique in any other case than toolbar with 16*16 size buttons and no text.
It's a pity!
|
|
|
|
 |
|
 |
don't do his silly:
m_wndToolBar.SetButtonInfo(nIndex, ID_COMBO, TBBS_SEPARATOR, 205);
there is no need to change the item to a separator... you can leave it as buttons but have enough unused buttons under it to fill the space... does take a bit of playing with...
using this you can also have multiple ComboBoxes...
the problem with the combobox needing to be on the end is a result of his 205 on the last part.
|
|
|
|
 |
|
 |
Thanks for idea, but I can't to put COMBO on few buttons. Can you explain how to do this?
My site: http://vfm-elita.com
|
|
|
|
 |
|
 |
Use the combobox member function SetItemHeight!
SetItemHeight(nItem, nHeight);
where
nItem is the index of the item (use -1 to change the height of the edit control)
nHeight is the item height in pixels
m_Combo.SetItemHeight(-1, 32) should fix it!
|
|
|
|
 |
|
 |
Hello and thanks for the reply
I actually found a solution to the problem myself, not as elegant as yours though. I've just added a static control as placeholder, then I resized it to the desired width, and later I added the combobox to the toolbar - the effect was great, exactly what I was looking for.
Thanks anyway,
Deian
|
|
|
|
 |
|
 |
thanks Deian
now i can finish my project
thank Deian thank goodness!
|
|
|
|
 |
|
 |
1. I has no idea how to mage a toolbar buttons different from standard... This is very simply: just resize 1 button in toolbar.
2. There are two solutions how to show combo in toolbar with big buttons. They are listed in other branches and here is code for 2nd one in conjunction with original code of combo putting on toolbar:
CRect rect;
int nIndex = m_wndToolBar.GetToolBarCtrl().CommandToIndex(ID_COMBO);
m_wndToolBar.SetButtonInfo(nIndex, ID_COMBO, TBBS_SEPARATOR , 400);
m_wndToolBar.GetToolBarCtrl().GetItemRect(nIndex, &rect);
CRect rectStatic=rect; // Create toolbar to hold separator's "drawings"
m_wndStatic.Create(NULL, WS_CHILD|WS_VISIBLE, rectStatic, &m_wndToolBar );
CRect rectCmb=rect;
rectCmb.top = 10;
rectCmb.bottom = rect.top + 250 /*drop height*/;
if(!m_comboBox.Create(CBS_DROPDOWNLIST | CBS_SORT | WS_VISIBLE |
WS_TABSTOP | WS_VSCROLL, rectCmb, &m_wndStatic, ID_COMBO))
{
TRACE(_T("Failed to create combo-box\n"));
return FALSE;
}
Probably this will helps to somebody.
My site: http://vfm-elita.com/div>
|
|
|
|
 |
|
 |
how can i get the events in my ListBox when i change my selection in this ListBox
|
|
|
|
 |
|
 |
What about adding combos in between two buttons.. Problem is ComboBox then appears with Seperator showing at the middle instead of side. .. That doesn't look nice..
If you set the zise of seperator to 150 say.. the it it vertical line at 75 pixels from left and 75 pixels after that..
none
|
|
|
|
 |
|
 |
don't make it a seperator... see the post I made under the 32x32 question
|
|
|
|
 |
|
 |
Hi,
thanx for the article, helped very much.
but I have one problem: how to make the size of the ComnboBox smaller?
I tried to put the CRect, but failed.
Respectfully,
Exceter.
|
|
|
|
 |
|
 |
Just change the number 205 at the end of the 'SetButtonInfo ...' line.
Henk L.
|
|
|
|
 |
|
 |
If you want insert CListBox in toolbar and call notification of CListBox SelChange then to do next step:
1. Add in toolbar button with id IDB_LIST_BOX
2. Add in class CMainFrame in MainFrm.h
class CMainFrame
{
/.../
protected:
CListBox m_listBox;
BOOL InitListBox (LPCREATESTRUCT lpCreateStruct);
afx_msg void OnSelChangeListBox ();
3. Add in MainFrm.cpp
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
/.../
ON_LBN_SELCHANGE(IDB_LIST_BOX, OnSelChangeListBox)
/.../
END_MESSAGE_MAP()
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
/... some text .../
// Insert after all
if (!InitListBox (lpCreateStruct))
return FALSE;
return 0;
}
BOOL CMainFrame::InitListBox (LPCREATESTRUCT lpCreateStruct)
{
CRect rect;
int nIndex = m_wndToolBar.GetToolBarCtrl().CommandToIndex (IDB_LIST_BOX);
m_wndToolBar.SetButtonInfo (nIndex, IDB_LIST_BOX, TBBS_SEPARATOR, 305);
m_wndToolBar.GetToolBarCtrl().GetItemRect(nIndex, &rect);
rect.top = 1;
rect.bottom = rect.top + 500;
// style must be LBS_NOTIFY !!!
if(!m_listBox.Create (WS_CHILD | CBS_SORT | WS_VISIBLE | WS_DLGFRAME |
WS_VSCROLL | LBS_NOTIFY, rect, &m_wndToolBar, IDB_LIST_BOX))
{
TRACE(_T("Failed to create ListBox\n"));
return FALSE;
}
// fill list box
/.../
// set GUI font
CFont font;
font.CreateStockObject (DEFAULT_GUI_FONT);
m_listBox.SetFont (&font);
font.DeleteObject ();
return TRUE;
}
Simvolokov Michael
|
|
|
|
 |
|
 |
When i tried to insert two combos,the whole toolbar is diappeared,why?
|
|
|
|
 |
|
 |
I ran into that too...
its because of the 205 image index he used
m_wndToolBar.SetButtonInfo(nIndex, ID_COMBO, TBBS_SEPARATOR, 205);
it seems to be a panic mode for the control.
try omitting that call and instead having disabled buttons under the comboBox... not nice, but works.
|
|
|
|
 |
|
 |
Hi,
You have the same problems we have while putting the toolbar to the left or the right of the screen. The combo box disapears. We still haven't found the solution for it. Maybe someoen can help us.
Kind regards,
Jeroen de Haas
Gateway Software
|
|
|
|
 |
|
 |
Hey guys,
Just put a seperator after the extreme right combobox or just before the combobox ,in case of extreme left combox.
It will fool MFC to think that there is a button and hence leave a height sufficient to draw a combobox(which is height of a button on toolbar), otherwise it will just keep the height for a seprator and hence combobox wil not be visible.
Hope it helps.
|
|
|
|
 |
|
 |
Hello,
The suggestion is really useful. Is there any limit in the number of combo boxes to be avaiable in the tool bar? I created 3 differnet toolbars. In one of the toolbars, i created 2 consecutive comboboxes (without any separator ) and i tried to add the third combobox in succession. But the toolbar itself didn;t appear. But it works fine for 2 comb boxes.
Please tell me the solution
With regards
Sriram
|
|
|
|
 |