hi all,
I don't know how to add a combobox in the statusbar can anyone help me.
amrsfmt
hi all,
I don't know how to add a combobox in the statusbar can anyone help me.
amrsfmt
Are you using the Win32 API or MFC?
hi all,
I would be glad if I know how to do it in both ways,
but know I need the MFC way.
I'm working with MFC.
amrsfmt
Well, in both MFC and the Win32 API, you would just create it as a child of the status bar. Anyhow, here is how you would do it. First, add a member to the CMainFrame class (CMainFrm.h by default) like this:
CComboBox m_wndCombo; // Our combobox control
In your CMainFrm.cpp file, you would do this (in the OnCreate function):
That should do what you need. You can change the parameters of "CRect()" to adjust position and size. If you need anymore help, just post a reply.Code:m_wndCombo.Create(WS_CHILD | WS_VISIBLE, // Styles CRect(0, 0, 200, 20), // Size and position m_wndStatusBar, // Parent window 1001);
thanks for your reply,
but I have this error:
I know there is a method to get the CWnd pointer but I don't remember it, I have searched the MSDN and didn't find it.error C2664: 'Create' : cannot convert parameter 3 from 'class CStatusBar' to 'class CWnd *'
amrsfmt
hi all,
thanks SyntaxBubble for your reply,
I have fixed the problem.
that's was the problem,Code:m_wndCombo.Create(WS_CHILD | WS_VISIBLE | WS_VSCORLL | CBS_DROPDOWNLIST, // Styles CRect(0, 0, 200, 20), // Size and position &m_wndStatusBar, // Parent window 1001);
know there is another problem that when I drop down the the list. It's limited by the size of the status bar which limit the viewing of the dropdown list, I think this problem my be solved by sizing the statusbar bigger.
Is that right?
thanks bye,
amrsfmt
Have you just tried changing the fourth (last) parameter in the CRect() function? If not, try to see if that is the problem. BTW, I'm glad I was of help to you.
Try setting the height of the combo box to something like 100 and see if that works for you.
Good luck,
Chris
thanks for your help,
that's what I have done exactly,
I have made the hight of the combobox 100,
so it worked.
thanks,
amrsfmt