EnableWindow Help
-
Hi All, I posted my question earlier also but wasn't really satisfied. So, asking it again. I have two comboboxes and if I select first item from first combobox then the second combobox should be disabled. And if I select any other items expect the first item from the first combobox, then the second combo box should be enabled. I know how to disble and enable a window(using EnableWindow) but the problem I have is that I am not able to select that first item in the first combobox selecting which I disable my second combobox. In the following code, I was trying it using GetCurSel and SetCurSel but it doesn't work. In the code, m_Au is the member of first combobox. V is the first item in the first combobox of #define type. m_C is the member of Second Combobox.
int nToken = m_Au.GetCurSel(); m_Au.SetCurSel(0); if (nToken == V) { m_C.EnableWindow(FALSE); } else { m_C.EnableWindow(TRUE); }
I populated my second combobox dynamically based on the first combobox. So, I mean to say that they are related to each other. I will really appreciate the help.C++Prog
-
Hi All, I posted my question earlier also but wasn't really satisfied. So, asking it again. I have two comboboxes and if I select first item from first combobox then the second combobox should be disabled. And if I select any other items expect the first item from the first combobox, then the second combo box should be enabled. I know how to disble and enable a window(using EnableWindow) but the problem I have is that I am not able to select that first item in the first combobox selecting which I disable my second combobox. In the following code, I was trying it using GetCurSel and SetCurSel but it doesn't work. In the code, m_Au is the member of first combobox. V is the first item in the first combobox of #define type. m_C is the member of Second Combobox.
int nToken = m_Au.GetCurSel(); m_Au.SetCurSel(0); if (nToken == V) { m_C.EnableWindow(FALSE); } else { m_C.EnableWindow(TRUE); }
I populated my second combobox dynamically based on the first combobox. So, I mean to say that they are related to each other. I will really appreciate the help.C++Prog
celllllllll wrote:
I have two comboboxes and if I select first item from first combobox then the second combobox should be disabled. And if I select any other items expect the first item from the first combobox, then the second combo box should be enabled.
if (0 == m_Au.GetCurSel())
{
m_C.EnableWindow(FALSE);
}
else
{
m_C.EnableWindow(TRUE);
} -
celllllllll wrote:
I have two comboboxes and if I select first item from first combobox then the second combobox should be disabled. And if I select any other items expect the first item from the first combobox, then the second combo box should be enabled.
if (0 == m_Au.GetCurSel())
{
m_C.EnableWindow(FALSE);
}
else
{
m_C.EnableWindow(TRUE);
}I really appreciate the answer but it doesn't work. It is disabling the second combobox for every selection in first combobox. So, basically we can say the "if" statement isn't working. Thanks for the help and reading the whole problem. Thank You
C++Prog
-
I really appreciate the answer but it doesn't work. It is disabling the second combobox for every selection in first combobox. So, basically we can say the "if" statement isn't working. Thanks for the help and reading the whole problem. Thank You
C++Prog
Where are you calling this code - in response to a CBN_SELCHANGE message? Are you still doing that m_Au.SetCurSel(0) ?? How about breaking it down...If you change the code as follows and put a breakpoint on the "if" line....what is the value of CurSel when you select say, the second item in the list?
int CurSel = m_Au.GetCurSel();
if (0 == CurSel)
{
m_C.EnableWindow(FALSE);
}
else
{
m_C.EnableWindow(TRUE);
} -
Hi All, I posted my question earlier also but wasn't really satisfied. So, asking it again. I have two comboboxes and if I select first item from first combobox then the second combobox should be disabled. And if I select any other items expect the first item from the first combobox, then the second combo box should be enabled. I know how to disble and enable a window(using EnableWindow) but the problem I have is that I am not able to select that first item in the first combobox selecting which I disable my second combobox. In the following code, I was trying it using GetCurSel and SetCurSel but it doesn't work. In the code, m_Au is the member of first combobox. V is the first item in the first combobox of #define type. m_C is the member of Second Combobox.
int nToken = m_Au.GetCurSel(); m_Au.SetCurSel(0); if (nToken == V) { m_C.EnableWindow(FALSE); } else { m_C.EnableWindow(TRUE); }
I populated my second combobox dynamically based on the first combobox. So, I mean to say that they are related to each other. I will really appreciate the help.C++Prog
-
Hi All, I posted my question earlier also but wasn't really satisfied. So, asking it again. I have two comboboxes and if I select first item from first combobox then the second combobox should be disabled. And if I select any other items expect the first item from the first combobox, then the second combo box should be enabled. I know how to disble and enable a window(using EnableWindow) but the problem I have is that I am not able to select that first item in the first combobox selecting which I disable my second combobox. In the following code, I was trying it using GetCurSel and SetCurSel but it doesn't work. In the code, m_Au is the member of first combobox. V is the first item in the first combobox of #define type. m_C is the member of Second Combobox.
int nToken = m_Au.GetCurSel(); m_Au.SetCurSel(0); if (nToken == V) { m_C.EnableWindow(FALSE); } else { m_C.EnableWindow(TRUE); }
I populated my second combobox dynamically based on the first combobox. So, I mean to say that they are related to each other. I will really appreciate the help.C++Prog
May be you'd want to keep the selection back to the first item after a selection has been made, so you should put it in the bottom. eg :
int nToken = m_Au.GetCurSel(); **m_Au.SetCurSel(0);** if (nToken == V) { m_C.EnableWindow(FALSE); } else { m_C.EnableWindow(TRUE); } **m_Au.SetCurSel(0);** //<------- Here
:Gong: 歡迎光臨 吐 西批 :Gong:
-
Hi All, I posted my question earlier also but wasn't really satisfied. So, asking it again. I have two comboboxes and if I select first item from first combobox then the second combobox should be disabled. And if I select any other items expect the first item from the first combobox, then the second combo box should be enabled. I know how to disble and enable a window(using EnableWindow) but the problem I have is that I am not able to select that first item in the first combobox selecting which I disable my second combobox. In the following code, I was trying it using GetCurSel and SetCurSel but it doesn't work. In the code, m_Au is the member of first combobox. V is the first item in the first combobox of #define type. m_C is the member of Second Combobox.
int nToken = m_Au.GetCurSel(); m_Au.SetCurSel(0); if (nToken == V) { m_C.EnableWindow(FALSE); } else { m_C.EnableWindow(TRUE); }
I populated my second combobox dynamically based on the first combobox. So, I mean to say that they are related to each other. I will really appreciate the help.C++Prog
Why it doesnt work?
WhiteSky
-
Why it doesnt work?
WhiteSky
I dunno know why it doesn't work.
int nToken = m_Aux.GetCurSel(); if (nToken == V) { m_C.EnableWindow(FALSE); m_Spin.SetRange(0,1000); } else { m_C.EnableWindow(TRUE); } m_Au.SetCurSel(0);
The code is disabling the complete second combobox but I wanted to disable it for V only. Don't know what to do ThanksC++Prog
-
I dunno know why it doesn't work.
int nToken = m_Aux.GetCurSel(); if (nToken == V) { m_C.EnableWindow(FALSE); m_Spin.SetRange(0,1000); } else { m_C.EnableWindow(TRUE); } m_Au.SetCurSel(0);
The code is disabling the complete second combobox but I wanted to disable it for V only. Don't know what to do ThanksC++Prog
Whats return value of EnableWindow for second combobox
WhiteSky