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.
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
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.
On a form, press CTRL+E, and the menu editor comes up.
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.
oo the menu editor :)
thx alot
can this be done with anything like buttons rtb and so on?
You can do a popup menu on any objects that you wish. I'd appreciate a toast for this :P
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);
}
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?
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
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.
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.
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
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
Anytime :D
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
Easily entertained... +1 LoL.
!~!HaZaRD!~!
It really doesn't take much to entertain me these days...just ask the missus