really simple button question
-
I've looked around for some example code for how to add a button ( or any other control) to a custom control which is based on a CWnd. All the examples are for adding buttons and stuff to dialogs. which is simple and easy and I'm sure this is to - i just want to get it done the right way. CButton m_Button; m_Button.Create( ...? ...? what is needed? (not useing a dialog) thanks
-
I've looked around for some example code for how to add a button ( or any other control) to a custom control which is based on a CWnd. All the examples are for adding buttons and stuff to dialogs. which is simple and easy and I'm sure this is to - i just want to get it done the right way. CButton m_Button; m_Button.Create( ...? ...? what is needed? (not useing a dialog) thanks
I'm not sure what it is you wish to achieve? A composite control that consists of a button and something else? Where you create that button will also depend on which you parent is going be. Pleas give a little more information. Happy programming!!
-
I've looked around for some example code for how to add a button ( or any other control) to a custom control which is based on a CWnd. All the examples are for adding buttons and stuff to dialogs. which is simple and easy and I'm sure this is to - i just want to get it done the right way. CButton m_Button; m_Button.Create( ...? ...? what is needed? (not useing a dialog) thanks
I hate to say this, but I don't understand how the documentation could be any clearer on this. m_Button.Create("OK", WS_VISIBLE|WS_CHILD, CRect(0,0,100,100), &m_the_control_i_want_as_parent, THE_ID_I_WANT_TO_USE_FOR_THIS_CONTROL); About the only two things in there that might be confusing are the styles, (which need only specify that the control should be shown (WS_VISIBLE) and that it's a child control (WS_CHILD)) and the ID, which usually MSDev creates for you. You just pick and ID that's unique to this dialog and use it. Now, this should work fine as long as the control you using as a parent doesn't blit over you with drawing code.