INTRODUCTION: I have a class(custom window) derived from CWND. This custom class has a radio button(CButton) and a bunch of other static controls.
The PROBLEM: When the radio button is created it's grayed out and clicking it does nothing. Code used for creation is pretty simple:
m_radioButton->Create(_T("rButton1.1"), WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON , CRect(5,5,300,15), this,2001);
I tried to add the
ON_BN_CLICKED(2001, method())
event but that isn't getting triggered.
I also have the ShowWindow() and EnableWindow() methods on it but that didn't work either.
The QUESTION: Since this class isn't derived from a CDialog means DDX isn't available. Can that be the problem? Is there a way to get around it? My message map only has a SIZE, CREATE and DESTROY other than the ON_BN_CLICKED.
Any suggestion are welcome.
SIDE NOTE: MFC newbie here, your help is much appreciated.
Research: I found only this relevant stack overflow question but that doesn't help my case. Also came across this cool page on mfc subclassing but it doesn't answer my question.
SIDE QUESTION: Since I'm not getting any answers, Is this situation not that common and Is this fundamentally wrong should I not derive from CWND at all and derive from CDialog or something else?
WS_GROUP
set, and also whatever control follows the last radio button in the tab order. – Mark RansomCreate
call, rather than the genericBUTTON
class. – Mark RansomCButton
s in it should be your starting point. Then, turn it into a radio button and only if that works, use your own windowclass. At some point, you will find that it fails, and there you have your (almost, at least) minimial example without which your question is off-topic here. – Ulrich Eckhardt