Achilles Posted January 7, 2007 Share Posted January 7, 2007 I've noticed that for most things you right click it brings up a menu with a list of all the things you can do. Is there a way you make these for our programs? It seems like it would kind of be the same things as a filemenu or traymenu, but both of those are in set positions... Any help/ideas appreciated! And on another note does anybody know how to make tray items bold? My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
xcal Posted January 7, 2007 Share Posted January 7, 2007 You want to use GuiCtrlCreateContextMenu and GuiCtrlCreateMenuItem. Here's an example: #include <GUIConstants.au3> GUICreate('', 80, 150) $lable1 = GUICtrlCreateLabel('', 10, 10, 60, 60) GUICtrlSetBkColor(-1, 0x00FF00) $lable2 = GUICtrlCreateLabel('', 10, 80, 60, 60) GUICtrlSetBkColor(-1, 0xFF0000) $menu1 = GUICtrlCreateContextMenu($lable1) $m1i1 = GUICtrlCreateMenuitem('label 1 item 1', $menu1) $m1i2 = GUICtrlCreateMenuitem('label 1 item 2', $menu1) $menu2 = GUICtrlCreateContextMenu($lable2) $m2i1 = GUICtrlCreateMenuitem('label 2 item 1', $menu2) $m2i2 = GUICtrlCreateMenuitem('label 2 item 2', $menu2) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $m1i1 MsgBox(0, '', 'label 1 item 1') Case $m1i2 MsgBox(0, '', 'label 1 item 2') Case $m2i1 MsgBox(0, '', 'label 2 item 1') Case $m2i2 MsgBox(0, '', 'label 2 item 2') EndSwitch WEnd How To Ask Questions The Smart Way Link to comment Share on other sites More sharing options...
Achilles Posted January 10, 2007 Author Share Posted January 10, 2007 You want to use GuiCtrlCreateContextMenu and GuiCtrlCreateMenuItem. Here's an example: #include <GUIConstants.au3> GUICreate('', 80, 150) $lable1 = GUICtrlCreateLabel('', 10, 10, 60, 60) GUICtrlSetBkColor(-1, 0x00FF00) $lable2 = GUICtrlCreateLabel('', 10, 80, 60, 60) GUICtrlSetBkColor(-1, 0xFF0000) $menu1 = GUICtrlCreateContextMenu($lable1) $m1i1 = GUICtrlCreateMenuitem('label 1 item 1', $menu1) $m1i2 = GUICtrlCreateMenuitem('label 1 item 2', $menu1) $menu2 = GUICtrlCreateContextMenu($lable2) $m2i1 = GUICtrlCreateMenuitem('label 2 item 1', $menu2) $m2i2 = GUICtrlCreateMenuitem('label 2 item 2', $menu2) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $m1i1 MsgBox(0, '', 'label 1 item 1') Case $m1i2 MsgBox(0, '', 'label 1 item 2') Case $m2i1 MsgBox(0, '', 'label 2 item 1') Case $m2i2 MsgBox(0, '', 'label 2 item 2') EndSwitch WEnd Sweet, thanks! That's exactly what I was looking for I just didn't know they were called context menus... My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
James Posted January 10, 2007 Share Posted January 10, 2007 This will be useful for BetaPad XD Thanks xcal. Secure Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
xcal Posted January 10, 2007 Share Posted January 10, 2007 Np, glad it was useful. How To Ask Questions The Smart Way Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now