MFC
-
Hi gurus, i have one dialogbox. it contains three listboxes, 1. I want to change items of one listbox contents depend on the selection of item in another List box. 2. for this purpose i need to handle OnSelChange() function. 3. How can add this OnSelChange() function to Dialog box class. thanks in advance, - Koteswara Rao
-
Hi gurus, i have one dialogbox. it contains three listboxes, 1. I want to change items of one listbox contents depend on the selection of item in another List box. 2. for this purpose i need to handle OnSelChange() function. 3. How can add this OnSelChange() function to Dialog box class. thanks in advance, - Koteswara Rao
-
Hi gurus, i have one dialogbox. it contains three listboxes, 1. I want to change items of one listbox contents depend on the selection of item in another List box. 2. for this purpose i need to handle OnSelChange() function. 3. How can add this OnSelChange() function to Dialog box class. thanks in advance, - Koteswara Rao
I think I understand what you want to do...try subclassing the dialog listbox controls. First derive a new class for each of the three listboxes from CListBox.
CMyListBox1
CMyListBox2
CMyListBox3Then, in your dialog's main header file (mydlg.h, or whatever) change the default from:
CListBox m_ListBox1;
CListBox m_ListBox2;
CListBox m_ListBox3;to:
CMyListBox1 m_ListBox1;
CMyListBox2 m_ListBox2;
CMyListBox3 m_ListBox3;Don't forget to #include the CMyListBox(x).h files in your code. Then, from your dialog's OnInitDialog function, subclass the controls using this code:
VERIFY(m_ListBox1.SubclassDlgItem(IDC_LISTBOX1, this));
VERIFY(m_ListBox2.SubclassDlgItem(IDC_LISTBOX2, this));
VERIFY(m_ListBox3.SubclassDlgItem(IDC_LISTBOX3, this));Finally, then you can handle the OnSelChange event in your CListBox derived classes. So, you really don't add the function to the dialog class, you make it so you can handle the function from within that class. Good Luck, Frank :)