CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: list view

  1. #1
    Join Date
    Feb 2000
    Posts
    440

    list view

    Hi,

    Given a listview, how can I catch the right-click on a certain item only, not the whole listview area.

    Thanks

    Valery Iskarov Nikolov
    Software Dynamics

  2. #2
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: list view


    'this works if you do not put a breackpoint in Mousedown
    'event (or it will prevent the triggering of itemClick event!)
    'Do not show msgboxes (or modal forms) in mousedown, too!
    option Explicit
    Dim intMouse as Integer
    private Sub Command1_Click()
    Dim i as Integer
    With ListView1
    for i = 1 to 10

    .ListItems.Add , "a" & i, "a" & i

    next i
    End With
    End Sub

    private Sub ListView1_ItemClick(byval Item as MSComctlLib.ListItem)

    If intMouse = 2 then
    Debug.print Item.Key & " right-cliclked!"
    End If
    End Sub

    private Sub ListView1_MouseDown(Button as Integer, Shift as Integer, x as Single, y as Single)
    intMouse = Button
    End Sub





    Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Michael
    and all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

    The Rater
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  3. #3
    Join Date
    Feb 2000
    Posts
    440

    Re: list view

    Special thanks to you, too !

    Valery Iskarov Nikolov
    Software Dynamics

  4. #4
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: you're welcome

    ;-)
    Have a nice day, Vin.



    Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Michael
    and all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

    The Rater
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured