Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: WiLD on July 02, 2003, 01:04 AM

Title: Right Menu
Post by: WiLD on July 02, 2003, 01:04 AM
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.
Title: Re:Right Menu
Post by: UserLoser on July 02, 2003, 01:13 AM
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
Title: Re:Right Menu
Post by: WiLD on July 02, 2003, 01:17 AM
Ok that helps alot, just 1 more thing what do you mean by:
QuoteCreate a menu like you normally would, just make it visible.
a menu using what? command buttons? or labels?
If you can answer that question it will be helping me alot.
Title: Re:Right Menu
Post by: UserLoser on July 02, 2003, 01:19 AM
On a form, press CTRL+E, and the menu editor comes up.
Title: Re:Right Menu
Post by: SNiFFeR on July 02, 2003, 01:22 AM
Quote from: WiLD on July 02, 2003, 01:17 AM
Ok that helps alot, just 1 more thing what do you mean by:
QuoteCreate a menu like you normally would, just make it visible.
a menu using what? command buttons? or labels?
If you can answer that question it will be helping me alot.
Right Click (on form) > Menu Editor:
Just uncheck the visible check on the menu editor.
Title: Re:Right Menu
Post by: WiLD on July 02, 2003, 01:25 AM
oo the menu editor :)
thx alot

can this be done with anything like buttons rtb and so on?
Title: Re:Right Menu
Post by: UserLoser on July 02, 2003, 01:27 AM
You can do a popup menu on any objects that you wish.  I'd appreciate a toast for this :P
Title: Re:Right Menu
Post by: DarkMinion on July 02, 2003, 07:41 AM

         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);
            }
Title: Re:Right Menu
Post by: WiLD on July 02, 2003, 11:09 AM
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?
Title: Re:Right Menu
Post by: DarkMod on July 02, 2003, 11:32 AM
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
Quoteif button = 2 then popupmenu mnuwhatever
end if

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

QuotePrivate Sub mnukick_Click()
csb.Send "/kick " & ListView1.SelectedItem.Text
End Sub

rinse and repeat :D

I hope this helps, cheers!
-Dmod
Title: Re:Right Menu
Post by: WiLD on July 02, 2003, 07:39 PM
That cant be right can it? Because of:

if button = 2 then popupmenu mnuwhatever
end if

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.
Title: Re:Right Menu
Post by: SNiFFeR on July 02, 2003, 07:49 PM
Then you do

Private sub mnukick_click()
csb.send "/kick " & listview1.selecteditem.text
end sub


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.
Title: Re:Right Menu
Post by: DarkMod on July 02, 2003, 07:52 PM
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
Title: Re:Right Menu
Post by: WiLD on July 02, 2003, 07:55 PM
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
Title: Re:Right Menu
Post by: DarkMod on July 02, 2003, 08:11 PM
Anytime :D
Title: Re:Right Menu
Post by: Eternal on July 03, 2003, 09:40 AM
Quote from: WiLD on July 02, 2003, 07:39 PM

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.

+1 for giving us a little diagram to look at, it amused me  ;D
Title: Re:Right Menu
Post by: Hazard on July 03, 2003, 09:45 AM
Easily entertained... +1 LoL.

!~!HaZaRD!~!
Title: Re:Right Menu
Post by: Eternal on July 03, 2003, 02:18 PM
It really doesn't take much to entertain me these days...just ask the missus