Enabling and Diabling a Control
-
Hi All, I have two ComboBox controls {A(it has items like A1, A2 and A3)and B (B has B1, B2 and B3)} and one spin control (Z). Now, my task is that when from control A, A1 is selected then full control B should be diabled. And for all others A2 and A3, B should get enabled. This is how my code is:
m_CtrlA.SetCurSel(0); m_CtrlB.ResetContent(); if (m_CtrlA.GetCurSel() == A1) { m_CtrlB.EnableWindow(FALSE); m_Spin.SetRange(0,1000); } else { m_CtrlB.EnableWindow(TRUE); }
So, the problem is what this code is doing is that it is disabling the full m_CtrlB for every case. But I want to disable it for A1 only. I would really appreciate if someone could help me. Thanks a lot in advanceC++Prog
-
Hi All, I have two ComboBox controls {A(it has items like A1, A2 and A3)and B (B has B1, B2 and B3)} and one spin control (Z). Now, my task is that when from control A, A1 is selected then full control B should be diabled. And for all others A2 and A3, B should get enabled. This is how my code is:
m_CtrlA.SetCurSel(0); m_CtrlB.ResetContent(); if (m_CtrlA.GetCurSel() == A1) { m_CtrlB.EnableWindow(FALSE); m_Spin.SetRange(0,1000); } else { m_CtrlB.EnableWindow(TRUE); }
So, the problem is what this code is doing is that it is disabling the full m_CtrlB for every case. But I want to disable it for A1 only. I would really appreciate if someone could help me. Thanks a lot in advanceC++Prog
-
Hi All, I have two ComboBox controls {A(it has items like A1, A2 and A3)and B (B has B1, B2 and B3)} and one spin control (Z). Now, my task is that when from control A, A1 is selected then full control B should be diabled. And for all others A2 and A3, B should get enabled. This is how my code is:
m_CtrlA.SetCurSel(0); m_CtrlB.ResetContent(); if (m_CtrlA.GetCurSel() == A1) { m_CtrlB.EnableWindow(FALSE); m_Spin.SetRange(0,1000); } else { m_CtrlB.EnableWindow(TRUE); }
So, the problem is what this code is doing is that it is disabling the full m_CtrlB for every case. But I want to disable it for A1 only. I would really appreciate if someone could help me. Thanks a lot in advanceC++Prog
In the if statement, A1 is used. What is A1 defined as?
m_CtrlA.SetCurSel(0); m_CtrlB.ResetContent(); if (m_CtrlA.GetCurSel() == A1)
if it's not 0 then this will never be equal, because you set the current selection to 0 before the if statement is executed. -
In the if statement, A1 is used. What is A1 defined as?
m_CtrlA.SetCurSel(0); m_CtrlB.ResetContent(); if (m_CtrlA.GetCurSel() == A1)
if it's not 0 then this will never be equal, because you set the current selection to 0 before the if statement is executed.Thanks for the quick response. A1 is define as: #define A1 (0) So, its value is Zero. And yes I should get rid of
m_CtrlA.SetCurSel(0);
C++Prog
-
Thanks for the quick response. A1 is define as: #define A1 (0) So, its value is Zero. And yes I should get rid of
m_CtrlA.SetCurSel(0);
C++Prog