• Welcome to Valhalla Legends Archive.
 

ListView help

Started by DarkMod, March 03, 2003, 04:58 PM

Previous topic - Next topic

DarkMod

I am using a ListView for my user list in a channel. I have a menu that pops up for ban/kick, whisper etc. The usual... My problem is that I need it to select the person when you click on him/her, and stay on that person. Right now it selects it when you put your cursor over it,and will switch to the next person if you move the cursor down, etc... which makes it very hard for using the menu. I am sure someone here knows how I can fix this, I appreciate the help!!

ILurker

#1
for channellist being the name of the list where items get added or deleted during join/leave.
Private Sub channellist_dblClick()

me.popupmenu nameofmenuhere
' the sub menus will be listed during pop up

End Sub


if one of the submenu name was ban, and you wanted the action to ban the selected user, you would do,
Private Sub ban_Click()
Dim selecteduser As String
    selecteduser = ChannelList.SelectedItem
'.selecteduser is the text of the item clicked.
    send "/ban " & selecteduser
End Sub

tA-Kane

#2
Something you could do is set the user's name into a variable before you bring up the menu.

Then, when the user selects an option, you read from that variable instead of directly from the list.
Macintosh programmer and enthusiast.
Battle.net Bot Programming: http://www.bash.org/?240059
I can write programs. Can you right them?

http://www.clan-mac.com
http://www.eve-online.com

Etheran

#3
There's a property you can change so that items aren't selected on hover.  

Camel

#4
Private Sub lvUsers_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    On Local Error Resume Next 'so it doesnt yell if you click below the last entry
    RaiseEvent OnClick(lvUsers.HitTest(X, Y).Tag, Button)
End Sub
Private Sub UL_OnClick(uName As String, Button As Integer)
    Select Case Button
...
        Case 2
            mnuUsrPopup.Tag = uName
            PopupMenu mnuUsrPopup
...
    End Select
    
    'txtSend.SetFocus
End Sub

DarkMod

#5
:D Thanks guys that was a big help!