Tiger Posted August 11, 2008 Share Posted August 11, 2008 I would like to create a menu in the round button. I have a example in the attachment The Code Opt("GUIOnEventMode", 1) #include <GUIConstants.au3> GUICreate("", 200, 200) GUISetOnEvent($GUI_EVENT_CLOSE, "_close") $icon = GUICtrlCreateIcon("restart.ico", -1, 0, 0, 32, 32) GUICtrlCreateMenuItem("Icon", $icon) GUISetState(@SW_SHOW) Func _close() Exit EndFunc ;==>_close While 1 Sleep(250) WEnd My UDFs:- _RegEnumKey Link to comment Share on other sites More sharing options...
Tiger Posted August 11, 2008 Author Share Posted August 11, 2008 Can everyone help me My UDFs:- _RegEnumKey Link to comment Share on other sites More sharing options...
Squirrely1 Posted August 11, 2008 Share Posted August 11, 2008 (edited) Hey Tiger.Maybe what you want is a context menu for the control ...GUICtrlCreateContextMenu ( [controlID] )As far as I know, this is the only type of menu you can make for the little green button.Edit 1: Correction - it wouldn't be simple, but you could make another window you built to appear when the mouse is hovering over the little green thing, and that window could be without a title bar and contain have only clickable label controls. Edited August 11, 2008 by Squirrely1 Das Häschen benutzt Radar Link to comment Share on other sites More sharing options...
Tiger Posted August 11, 2008 Author Share Posted August 11, 2008 contextmenu = right click on the mouse normal menu = left click on the mouse And I would like to create a normal menu for the little green button My UDFs:- _RegEnumKey Link to comment Share on other sites More sharing options...
Developers Jos Posted August 11, 2008 Developers Share Posted August 11, 2008 check example 2 for GUICtrlCreateContextMenu. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Tiger Posted August 11, 2008 Author Share Posted August 11, 2008 Thanks but there is still no menuitem under the green icon expandcollapse popupOpt("GUIOnEventMode", 1) #include <GUIConstants.au3> $gui = GUICreate("", 200, 200) GUISetOnEvent($GUI_EVENT_CLOSE, "_close") $ribbon = GUICtrlCreateIcon("restart.ico", -1, 0, 0, 32, 32, $BS_FLAT) GUICtrlSetOnEvent(-1, "_ribbon") $ribbondummy = GUICtrlCreateDummy() $ribboncontext = GUICtrlCreateContextMenu($ribbondummy) $ribbonexit = GUICtrlCreateMenuItem("Exit", $ribboncontext) GUISetState(@SW_SHOW) Func _ribbon() ShowMenu($gui, $ribbon, $ribboncontext) EndFunc ;==>_ribbon Func _close() Exit EndFunc ;==>_close ; Show a menu in a given GUI window which belongs to a given GUI ctrl Func ShowMenu($hWnd, $CtrlID, $nContextID) Local $hMenu = GUICtrlGetHandle($nContextID) $arPos = ControlGetPos($hWnd, "", $CtrlID) Local $x = $arPos[0] Local $y = $arPos[1] + $arPos[3] ClientToScreen($hWnd, $x, $y) TrackPopupMenu($hWnd, $hMenu, $x, $y) EndFunc ; Convert the client (GUI) coordinates to screen (desktop) coordinates Func ClientToScreen($hWnd, ByRef $x, ByRef $y) Local $stPoint = DllStructCreate("int;int") DllStructSetData($stPoint, 1, $x) DllStructSetData($stPoint, 2, $y) DllCall("user32.dll", "int", "ClientToScreen", "hwnd", $hWnd, "ptr", DllStructGetPtr($stPoint)) $x = DllStructGetData($stPoint, 1) $y = DllStructGetData($stPoint, 2) ; release Struct not really needed as it is a local $stPoint = 0 EndFunc ; Show at the given coordinates (x, y) the popup menu (hMenu) which belongs to a given GUI window (hWnd) Func TrackPopupMenu($hWnd, $hMenu, $x, $y) DllCall("user32.dll", "int", "TrackPopupMenuEx", "hwnd", $hMenu, "int", 0, "int", $x, "int", $y, "hwnd", $hWnd, "ptr", 0) EndFunc While 1 Sleep(250) WEnd My UDFs:- _RegEnumKey Link to comment Share on other sites More sharing options...
Developers Jos Posted August 11, 2008 Developers Share Posted August 11, 2008 You need to tell the GUI to fire a message for a ICO control: $ribbon = GUICtrlCreateIcon("restart.ico", -1, 0, 0, 32, 32, BitOR($BS_FLAT,$SS_NOTIFY)) Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Tiger Posted August 11, 2008 Author Share Posted August 11, 2008 Thanks for your help. My UDFs:- _RegEnumKey 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