Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Message for scrolling listctrl?

Message for scrolling listctrl?

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mathias
    wrote on last edited by
    #1

    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

    L 1 Reply Last reply
    0
    • M 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

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      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.

      M 1 Reply Last reply
      0
      • L Lost User

        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.

        M Offline
        M Offline
        Mathias
        wrote on last edited by
        #3

        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

        L 1 Reply Last reply
        0
        • M 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

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups