I have this code :
m_pBtnCom = new CButton();
m_pBtnCom->Create(_T("Push"), WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON|BS_TEXT|BS_VCENTER|BS_CENTER, rc, this, BTN_CMT);
Where:
this
= my derivedCWnd
classrc
=CRect
button positionBTN_CMT
= button id
Current context:
If I disable the parent CWnd
by calling EnableWindow(FALSE)
, even if I call the function EnableWindow(TRUE)
on the button (m_pBtnCom->EnableWindow(TRUE)
), the latter remains disabled; Therefore, nothing works on it: click, tooltip, ...
I tried to remove WS_CHILD
, without success
Question:
Is it possible to activate the button when the window (argument this
in my code) is disabled?
Child window can't be independently enabled when parent window is disabled. You can instead enable all children, then go back and enable the particular button.
Note, if you have
IDCANCEL
button, and you disable it, then the dialog's close button is not functioning either and it gets confusing. You may want to avoid disabling the cancel button and overrideOnCancel