CListBox
-
Dear all, I have created a CListBox, with several lines of string, in a dialogbox. How can I call another function automatically whenever the selection of string in the list box is changed (by the up and down arrow key)? For example, in the function I want to get the text of the new position of the cursor selection whenever the selection is changed etc.. Looking forward to your sincere reply! Thanks!
-
Dear all, I have created a CListBox, with several lines of string, in a dialogbox. How can I call another function automatically whenever the selection of string in the list box is changed (by the up and down arrow key)? For example, in the function I want to get the text of the new position of the cursor selection whenever the selection is changed etc.. Looking forward to your sincere reply! Thanks!
1- Add the
OnSelchangeList()
for selection handler 2- Get the index of the current selection like this:int index = m_List.GetCurSel();
3- Do whatever you want with the index. One idea is to put a switch statement and call functions within. Good Luck! :)