Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: DarkMod on March 03, 2003, 04:58 PM

Title: ListView help
Post by: DarkMod on March 03, 2003, 04:58 PM
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!!
Title: Re: ListView help
Post by: ILurker on March 03, 2003, 06:13 PM
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
Title: Re: ListView help
Post by: tA-Kane on March 03, 2003, 10:56 PM
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.
Title: Re: ListView help
Post by: Etheran on March 04, 2003, 10:32 AM
There's a property you can change so that items aren't selected on hover.  
Title: Re: ListView help
Post by: Camel on March 04, 2003, 11:37 AM
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
Title: Re: ListView help
Post by: DarkMod on March 04, 2003, 01:53 PM
:D Thanks guys that was a big help!