Results 1 to 5 of 5

Thread: [RESOLVED] listview question

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2005
    Posts
    1,364

    Resolved [RESOLVED] listview question

    VB Code:
    1. Private Sub ListView1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
    2.     Dim oItem As ListItem
    3.     If Button = vbRightButton Then
    4.         Set oItem = ListView1.HitTest(x, y)
    5.         If Not oItem Is Nothing Then
    6.             oItem.Selected = True
    7.             PopupMenu mnuPopup
    8.         End If
    9.        
    10.     Else
    11.         Text2.Text = ListView1.SelectedItem.ListSubItems.Item(1)
    12.     End If
    13. End Sub

    Im trying to make the selected item appear in text2.txt, but it only appears when i double click it with left mouse click , how can i make it appear on a single click?

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: listview question

    Quote Originally Posted by Pouncer
    Im trying to make the selected item appear in text2.txt, but it only appears when i double click it with left mouse click , how can i make it appear on a single click?
    A single left mouse click or a single right mouse click?

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2005
    Posts
    1,364

    Re: listview question

    single left mouse click

  4. #4
    Frenzied Member oh1mie's Avatar
    Join Date
    Sep 2001
    Location
    Finland
    Posts
    1,043

    Re: listview question

    VB Code:
    1. Private Sub ListView1_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single)
    2.    
    3.     If ListView1.HitTest(x, Y) Is Nothing Then Exit Sub
    4.     If Button = vbRightButton Then
    5.        PopupMenu mnuPopup
    6.     End If
    7.  
    8. End Sub
    oh1mie/Vic


  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: listview question

    If you are going to use a Single Left mouse click, you can use your MouseDown event for your popup and the ListView's click event to pop the text in the textbox.
    VB Code:
    1. Private Sub ListView1_Click()
    2. Text1.Text = ListView1.SelectedItem.Text

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