Valhalla Legends Forums Archive | Battle.net Bot Development | Right Menu

AuthorMessageTime
WiLD
Ok i dont no the correct name for it, but i want to add a right click menu for my channel list. Im using a listview for my channel list and i want it so when u right click it comes up with options like profile stats and so on.
July 2, 2003, 6:04 AM
UserLoser
This should be in the general programming section... Anyways...

Create a menu like you normally would, just make it visible.
Then on your ListView_MouseUp() [I think] Put:
If Button = 2 Then PopupMenu mnuSomeMenu
1 = left, 2 = right, 3 = middle
July 2, 2003, 6:13 AM
WiLD
Ok that helps alot, just 1 more thing what do you mean by:
[quote]Create a menu like you normally would, just make it visible.[/quote]
a menu using what? command buttons? or labels?
If you can answer that question it will be helping me alot.
July 2, 2003, 6:17 AM
UserLoser
On a form, press CTRL+E, and the menu editor comes up.
July 2, 2003, 6:19 AM
SNiFFeR
[quote author=WiLD link=board=17;threadid=1776;start=0#msg13549 date=1057126639]
Ok that helps alot, just 1 more thing what do you mean by:
[quote]Create a menu like you normally would, just make it visible.[/quote]
a menu using what? command buttons? or labels?
If you can answer that question it will be helping me alot.
[/quote]
Right Click (on form) > Menu Editor:
Just uncheck the visible check on the menu editor.
July 2, 2003, 6:22 AM
WiLD
oo the menu editor :)
thx alot

can this be done with anything like buttons rtb and so on?
July 2, 2003, 6:25 AM
UserLoser
You can do a popup menu on any objects that you wish. I'd appreciate a toast for this :P
July 2, 2003, 6:27 AM
DarkMinion
[code]
         if(wParam == MAKEWPARAM(IDC_CHANLIST, 0)){
            if(Header->code == NM_RCLICK){
               int iSel = GetListViewSelectedItem(hChanList);
               if(iSel == -1)
                  return TRUE;
               GetListViewItemText(hChanList, iSel, szMenuBuf);
               POINT pt;
               GetCursorPos(&pt);
               HMENU hMenu = LoadMenu(hDlgInst, MAKEINTRESOURCE(IDR_LISTMENU));
               hMenu = GetSubMenu(hMenu, 0);
               TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hMain, NULL);
            }
[/code]
July 2, 2003, 12:41 PM
WiLD
ok and that means....?

umm i was just testing and added 2 options, but when i right click it it displays the same form. how can i make them do different things?
if test and button = 2 then
msgbox "this is test"
end if
if testing and button = 2 then
msgbox "this is testing"
end if

would that work?
July 2, 2003, 4:09 PM
DarkMod
Ok, you make the menu you want to pop up, normally it would show that menu on the top of the form, but by unclicking the visible checkbox it is not up there, then go to the listview(or whatever you want it on) I am assuming it is a list view so you can right click on a name, and kick them or whatever. double click on the listview and add
[quote] if button = 2 then popupmenu mnuwhatever
end if [/quote]

then to actually make it do something when you click on one of those options (i am assuming your using csb) add a code similar to this to one of your mnu subs

[quote] Private Sub mnukick_Click()
csb.Send "/kick " & ListView1.SelectedItem.Text
End Sub [/quote]

rinse and repeat :D

I hope this helps, cheers!
-Dmod
July 2, 2003, 4:32 PM
WiLD
That cant be right can it? Because of:
[code]
if button = 2 then popupmenu mnuwhatever
end if
[/code]
now say i changed mnuwhatever to mnutest(yes i have 1 called mnutest) it will only show that one, and it will only do that command wouldnt it?

Diagram:
---------------------
|LISTVIEW | <---- You right click this and
| | a menu like the below appears
| |
| | |ŻŻŻŻŻŻŻŻŻ|
| | | Kick |
---------------------- | Ban |
ŻŻŻŻŻŻŻŻŻŻ
You select a option and it
does it. Like in stealth bot.
July 3, 2003, 12:39 AM
SNiFFeR
Then you do
[code]
Private sub mnukick_click()
csb.send "/kick " & listview1.selecteditem.text
end sub
[/code]

Make sure you name the option Kick "mnukick" or else it will not work.
And you must make a sub for each option you have in your menu.
July 3, 2003, 12:49 AM
DarkMod
yes that is correct :) remember you have a menu (mnutest) then you have items in the menu ie: kick, ban, squelch in the menu editor it should look like this

TestMenuOrWhateverYouCallIt
....kick
....ban
....ect

so when you call for mnutest it pops up a menu with all the below in it, make sure you are putting subitems in the menus, and not just making a bunch of stand alone menus :P

-DMod
July 3, 2003, 12:52 AM
WiLD
Ok i know why it didnt work now. Because when i added a menu eg:

Menu
···Kick

It said at least 1 submenu must be visble, and i had Kick not visble lol.
Well its all working now.
Thx alot all
July 3, 2003, 12:55 AM
DarkMod
Anytime :D
July 3, 2003, 1:11 AM
Eternal
[quote author=WiLD link=board=17;threadid=1776;start=0#msg13677 date=1057192753]

Diagram:
---------------------
|LISTVIEW | <---- You right click this and
| | a menu like the below appears
| |
| | |ŻŻŻŻŻŻŻŻŻ|
| | | Kick |
---------------------- | Ban |
ŻŻŻŻŻŻŻŻŻŻ
You select a option and it
does it. Like in stealth bot.
[/quote]

+1 for giving us a little diagram to look at, it amused me ;D
July 3, 2003, 2:40 PM
DrivE
Easily entertained... +1 LoL.

!~!HaZaRD!~!
July 3, 2003, 2:45 PM
Eternal
It really doesn't take much to entertain me these days...just ask the missus
July 3, 2003, 7:18 PM

Search