CListBox and Scrollbar...
-
Does anybody know how to retrieve a WIN-message that indicates the scrollbar of a Listbox having been scrolled up or down? I have a modeless dialog with 6 listboxes (side by side) that get the V-Scrollbar automatically when there are more Items to display than the LBs can show at once. All lists do always have the same lenght due to the behaviour of my data. What I want is to keep the LBs synchron - I mean that the TOPINDEX is the same in all my boxes. Even when I move the scrollbar I wanna keep them in sync. That works fine with the LBN_SELCHANGE for every box: void CMyClass::OnSelchangeList01() { int iResult; iResult = m_List01.GetCurSel(); m_List01.SetCurSel(iResult); m_List02.SetCurSel(iResult); m_List03.SetCurSel(iResult); m_List04.SetCurSel(iResult); m_List05.SetCurSel(iResult); m_List06.SetCurSel(iResult); iResult = m_List01.GetTopIndex(); m_List01.SetTopIndex(); m_List02.SetTopIndex(); m_List03.SetTopIndex(); m_List04.SetTopIndex(); m_List05.SetTopIndex(); m_List06.SetTopIndex(); } The same I do for OnSelchangeList02(); OnSelchangeList03(); OnSelchangeList04(); OnSelchangeList05(); OnSelchangeList06(); I can select whatever I want in whatever LB - with the mouse or the arrow-keys. The TopIndex of every LB is the same and the selected items (highlighted) appear side by side. So far so good - ONLY after moving the vertical scrollbar the LBs are out of sync because I cannot get any message of the scrollbar showing me that the visual state of the LB has changed and though giving me the possibility to use the SetTopIndex()-function like above in the LBN_SELCHANGE message handler of my LBs... I tried it with CWnd::OnVScroll() but I couldn't find a way to retrieve a notification from my Listbox-scrollbars out of this function... All those nice SB_BOTTOM, SB_TOP, SB_THUMBTRACK - and I cannot access them...... So any Ideas out there...? Manfred --- Programming is knowing...
-
Does anybody know how to retrieve a WIN-message that indicates the scrollbar of a Listbox having been scrolled up or down? I have a modeless dialog with 6 listboxes (side by side) that get the V-Scrollbar automatically when there are more Items to display than the LBs can show at once. All lists do always have the same lenght due to the behaviour of my data. What I want is to keep the LBs synchron - I mean that the TOPINDEX is the same in all my boxes. Even when I move the scrollbar I wanna keep them in sync. That works fine with the LBN_SELCHANGE for every box: void CMyClass::OnSelchangeList01() { int iResult; iResult = m_List01.GetCurSel(); m_List01.SetCurSel(iResult); m_List02.SetCurSel(iResult); m_List03.SetCurSel(iResult); m_List04.SetCurSel(iResult); m_List05.SetCurSel(iResult); m_List06.SetCurSel(iResult); iResult = m_List01.GetTopIndex(); m_List01.SetTopIndex(); m_List02.SetTopIndex(); m_List03.SetTopIndex(); m_List04.SetTopIndex(); m_List05.SetTopIndex(); m_List06.SetTopIndex(); } The same I do for OnSelchangeList02(); OnSelchangeList03(); OnSelchangeList04(); OnSelchangeList05(); OnSelchangeList06(); I can select whatever I want in whatever LB - with the mouse or the arrow-keys. The TopIndex of every LB is the same and the selected items (highlighted) appear side by side. So far so good - ONLY after moving the vertical scrollbar the LBs are out of sync because I cannot get any message of the scrollbar showing me that the visual state of the LB has changed and though giving me the possibility to use the SetTopIndex()-function like above in the LBN_SELCHANGE message handler of my LBs... I tried it with CWnd::OnVScroll() but I couldn't find a way to retrieve a notification from my Listbox-scrollbars out of this function... All those nice SB_BOTTOM, SB_TOP, SB_THUMBTRACK - and I cannot access them...... So any Ideas out there...? Manfred --- Programming is knowing...
Maybe you could use a multi-column list? Daniel "das leid schlaft in der maschine" -Einstürzende Neubauten
-
Does anybody know how to retrieve a WIN-message that indicates the scrollbar of a Listbox having been scrolled up or down? I have a modeless dialog with 6 listboxes (side by side) that get the V-Scrollbar automatically when there are more Items to display than the LBs can show at once. All lists do always have the same lenght due to the behaviour of my data. What I want is to keep the LBs synchron - I mean that the TOPINDEX is the same in all my boxes. Even when I move the scrollbar I wanna keep them in sync. That works fine with the LBN_SELCHANGE for every box: void CMyClass::OnSelchangeList01() { int iResult; iResult = m_List01.GetCurSel(); m_List01.SetCurSel(iResult); m_List02.SetCurSel(iResult); m_List03.SetCurSel(iResult); m_List04.SetCurSel(iResult); m_List05.SetCurSel(iResult); m_List06.SetCurSel(iResult); iResult = m_List01.GetTopIndex(); m_List01.SetTopIndex(); m_List02.SetTopIndex(); m_List03.SetTopIndex(); m_List04.SetTopIndex(); m_List05.SetTopIndex(); m_List06.SetTopIndex(); } The same I do for OnSelchangeList02(); OnSelchangeList03(); OnSelchangeList04(); OnSelchangeList05(); OnSelchangeList06(); I can select whatever I want in whatever LB - with the mouse or the arrow-keys. The TopIndex of every LB is the same and the selected items (highlighted) appear side by side. So far so good - ONLY after moving the vertical scrollbar the LBs are out of sync because I cannot get any message of the scrollbar showing me that the visual state of the LB has changed and though giving me the possibility to use the SetTopIndex()-function like above in the LBN_SELCHANGE message handler of my LBs... I tried it with CWnd::OnVScroll() but I couldn't find a way to retrieve a notification from my Listbox-scrollbars out of this function... All those nice SB_BOTTOM, SB_TOP, SB_THUMBTRACK - and I cannot access them...... So any Ideas out there...? Manfred --- Programming is knowing...
surely you can put an ON_NOTIFY() handler for the WM_VSCROLL message? :suss: --- "every year we invent better idiot proof systems and every year they invent better idiots"
-
surely you can put an ON_NOTIFY() handler for the WM_VSCROLL message? :suss: --- "every year we invent better idiot proof systems and every year they invent better idiots"
Listbox Notification works only if a list item has been clicked or double-clicked... Or show me exactly what you mean...!?! :confused: Manfred --- Programming is knowing...
-
Listbox Notification works only if a list item has been clicked or double-clicked... Or show me exactly what you mean...!?! :confused: Manfred --- Programming is knowing...
hmmmmmm i been messing about for a few hours and it seems you're right ... duhhh ... well at least i can't get it to notify me either ... sheesh ... i wonder if mfc doesn't let that message get 'out of the box' so to speak sorry :( --- "every year we invent better idiot proof systems and every year they invent better idiots"
-
hmmmmmm i been messing about for a few hours and it seems you're right ... duhhh ... well at least i can't get it to notify me either ... sheesh ... i wonder if mfc doesn't let that message get 'out of the box' so to speak sorry :( --- "every year we invent better idiot proof systems and every year they invent better idiots"
I got the same problem too. I try to resolve it by disable the scroll bar in CListBox,and insert a CScrollBar to control all CListBoxes. But, very weird is that I can not see any usable message for scrollbar in ClassWizard!? Does anybody know why? How could I control a Scroll bar? I really need help!:(