ListView Scroll Event

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Urs Vogel

    ListView Scroll Event

    Hi

    I'm looking for a way to trap the ListView's scroll events, in order to
    control page-wise loading of not bindable data. Any hints of how to achieve
    this?

    Thanks, Urs


  • Robin Tucker

    #2
    Re: ListView Scroll Event

    What you want is a "virtual list view". I don't see ListView as
    particularly viable for this (I have tried it before). In the end I wrote
    my own control which does the same and allows me to owner draw each row
    (including images in cells).


    "Urs Vogel" <uvogel@msn.com > wrote in message
    news:umwGzz2DFH A.208@TK2MSFTNG P12.phx.gbl...[color=blue]
    > Hi
    >
    > I'm looking for a way to trap the ListView's scroll events, in order to
    > control page-wise loading of not bindable data. Any hints of how to
    > achieve this?
    >
    > Thanks, Urs
    >[/color]


    Comment

    • Urs Vogel

      #3
      Re: ListView Scroll Event

      Thanks Robin

      I'll inherit ListView and attach my own vertical scroll bar, using some API
      calls to achieve some controllable and synchronized scrolling behaviour.

      Urs

      "Robin Tucker" <idontwanttobes pammedanymore@r eallyidont.com> schrieb im
      Newsbeitrag news:cufl6j$is1 $1$8300dec7@new s.demon.co.uk.. .[color=blue]
      > What you want is a "virtual list view". I don't see ListView as
      > particularly viable for this (I have tried it before). In the end I wrote
      > my own control which does the same and allows me to owner draw each row
      > (including images in cells).
      >
      >
      > "Urs Vogel" <uvogel@msn.com > wrote in message
      > news:umwGzz2DFH A.208@TK2MSFTNG P12.phx.gbl...[color=green]
      >> Hi
      >>
      >> I'm looking for a way to trap the ListView's scroll events, in order to
      >> control page-wise loading of not bindable data. Any hints of how to
      >> achieve this?
      >>
      >> Thanks, Urs
      >>[/color]
      >
      >[/color]


      Comment

      • Ken Tucker [MVP]

        #4
        Re: ListView Scroll Event

        Hi,

        Use the native window class to listen for the scroll messages on
        the listbox. Will work with any control.

        ' NativeWindow class to listen to operating system messages.

        Private Class MyListener

        Inherits NativeWindow

        Public Event MyScroll(ByVal sender As Object, ByVal e As EventArgs)

        Const WM_MOUSEACTIVAT E = &H21

        Const WM_MOUSEMOVE = &H200



        Private ctrl As Control

        Public Sub New(ByVal ctrl As Control)

        AssignHandle(ct rl.Handle)

        End Sub

        Protected Overrides Sub WndProc(ByRef m As Message)

        ' Listen for operating system messages

        Const WM_HSCROLL = &H114

        Const WM_VSCROLL = &H115





        If m.Msg = WM_Hscroll Or m.Msg = wm_vscroll Then

        RaiseEvent MyScroll(ctrl, New EventArgs)

        End If

        MyBase.WndProc( m)

        End Sub

        Protected Overrides Sub Finalize()

        ReleaseHandle()

        MyBase.Finalize ()

        End Sub

        End Class

        Dim WithEvents sl As MyListener

        Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
        System.EventArg s) Handles MyBase.Load

        sl = New MyListener(List Box1)

        end sub



        Private Sub sl_MyScroll(ByV al sender As Object, ByVal e As System.EventArg s)
        Handles sl.MyScroll

        Me.Text = "Scroll"

        End Sub






        Ken

        -------------------------------
        "Urs Vogel" <uvogel@msn.com > wrote in message
        news:umwGzz2DFH A.208@TK2MSFTNG P12.phx.gbl...
        Hi

        I'm looking for a way to trap the ListView's scroll events, in order to
        control page-wise loading of not bindable data. Any hints of how to achieve
        this?

        Thanks, Urs



        Comment

        Working...