• Welcome to Valhalla Legends Archive.
 

Right Menu

Started by WiLD, July 02, 2003, 01:04 AM

Previous topic - Next topic

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.
=_=  &&  g0dFraY  &&  -=Templar=-  @USWest

UserLoser

#1
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

WiLD

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.
=_=  &&  g0dFraY  &&  -=Templar=-  @USWest

UserLoser

On a form, press CTRL+E, and the menu editor comes up.

SNiFFeR

#4
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.

WiLD

oo the menu editor :)
thx alot

can this be done with anything like buttons rtb and so on?
=_=  &&  g0dFraY  &&  -=Templar=-  @USWest

UserLoser

You can do a popup menu on any objects that you wish.  I'd appreciate a toast for this :P

DarkMinion


         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);
            }

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?
=_=  &&  g0dFraY  &&  -=Templar=-  @USWest

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
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

WiLD

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.
=_=  &&  g0dFraY  &&  -=Templar=-  @USWest

SNiFFeR

#11
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.

DarkMod

#12
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

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
=_=  &&  g0dFraY  &&  -=Templar=-  @USWest

DarkMod