Message for scrolling listctrl?
-
Hello! I've created a CListCtrl with ownerdraw and everything works just dandy, but there is one thing. What message does Windows send when the user uses the down and up arrows to scroll in the list? It's not the normal WM_VSCROLL when using the scrollbar, it's something else. I need the message that comes after the listctrl has been redrawn. Please help me! /Mathias
-
Hello! I've created a CListCtrl with ownerdraw and everything works just dandy, but there is one thing. What message does Windows send when the user uses the down and up arrows to scroll in the list? It's not the normal WM_VSCROLL when using the scrollbar, it's something else. I need the message that comes after the listctrl has been redrawn. Please help me! /Mathias
Hello Mathias, what you can do is trap the message (when the user pushes the up or down arrow = button) and then use this functions to scroll: BOOL Scroll( CSize size ); Check the msdn for more specifics on the functions. Since it's an ownerdrawn CListCtrl, you'll have to redraw everything yourself.
-
Hello Mathias, what you can do is trap the message (when the user pushes the up or down arrow = button) and then use this functions to scroll: BOOL Scroll( CSize size ); Check the msdn for more specifics on the functions. Since it's an ownerdrawn CListCtrl, you'll have to redraw everything yourself.
First of all, thanx for the hint. I was probably not descriping my question enough. The thing is, when the list has more items than can be shown and the user selects the item at the bottom of the list window(that are shown, more items below) the listcontrol automatically scroll down(I want it this way,EnsureVisible(...)) one row. This is where the problem start. After it has repainted itself, I need to calculate what items are shown and therefore wants a message from Windows telling me that it has been done, like the message SB_ENDSCROLL associated with CWnd::OnVScroll. Thanks! /Mathias
-
First of all, thanx for the hint. I was probably not descriping my question enough. The thing is, when the list has more items than can be shown and the user selects the item at the bottom of the list window(that are shown, more items below) the listcontrol automatically scroll down(I want it this way,EnsureVisible(...)) one row. This is where the problem start. After it has repainted itself, I need to calculate what items are shown and therefore wants a message from Windows telling me that it has been done, like the message SB_ENDSCROLL associated with CWnd::OnVScroll. Thanks! /Mathias
Maybe you have to take a different approach: you said: >>I need to calculate what items are shown Then you could use this function: int GetTopIndex( ) const; (=The index of the topmost visible item.) Since the listcontrol is owner drawn, you should get a WM_DRAWITEM message. You should make a handler for this and then you can use the GetTopIndex function to get the first visible item.