I need to get a CComboBox and a CButton by one ID. So I want to put them together in one class derived from CWnd.
I did that with two buttons, no problem create the class with Create(_T("BUTTON"),...
But now I need button and combo!
I want to create a control as a combination of a CComboBox and a CButton (see attachment).
I need it for a dynamic created view in wich I must know the ID of every control.
Now I took CView as base-class. I can see the controls but no reaction.
create a new class and derive it from CWnd.
your class has two members CComboBox and CButton.
in OnCreate event, create the two members on the position you need to.
Code:
int OnCreate( ... )
{
....
// set some styles
m_ctlCombo.Create( dwStyles, rcComboPos, (CWnd*) this, dwComboID );
m_ctlButton.Create( _T("...")/*caption*/, dwStyles, rcButtonPos, (CWnd*) this, dwButtonID);
}
That is excactly what I did. The problem ist that I must call create on the class. And there I have to give the classname. If I do with "BUTTON" then the button works, if I do it with "COMBO" the combobox works. If I do it with NULL, none of them work.
That is excactly what I did. The problem ist that I must call create on the class. And there I have to give the classname. If I do with "BUTTON" then the button works, if I do it with "COMBO" the combobox works. If I do it with NULL, none of them work.
Michael
No, you may not use "BUTTON" nor "COMBO" for your custom window control. From MSDN :
Its "class name can be any name registered with the global AfxRegisterWndClass function...."
So call AfxRegisterWndClass to register the class name and use its return value as a
class name The CWnd::Create needs.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.