MDCT Posted November 28, 2018 Posted November 28, 2018 Hello, I am trying to create a context menu with various controls inside of it, not context menu of various controls. Having search the forum, I cannot find this subject, mostly context menu on controls. Below is picture of what I want to achieve, icons on context menu. https://imgur.com/a/6UtKBb9 This example I got from other topic on forum, but I have no idea how to manipulate the context menu: #NoTrayIcon Opt('GUIOnEventMode', 1) Global $hGui = GUICreate("Dummy Gui", 0, 0, -200, -200, -1, 0, WinGetHandle(AutoItWinGetTitle())) GUISetState() Global $Context = GUICtrlCreateContextMenu(GUICtrlCreateDummy()) Global $OptionsOpen = GUICtrlCreateMenuItem("&Open", $Context) GUICtrlSetOnEvent(-1, '_Hello') Global $OptionsClose = GUICtrlCreateMenuItem("&Close", $Context) GUICtrlCreateMenuItem("", $Context) Global $OptionsExit = GUICtrlCreateMenuItem("&Exit", $Context) TrackPopupMenu($hGui, GUICtrlGetHandle($Context), MouseGetPos(0), MouseGetPos(1)) ; 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 ;==>TrackPopupMenu Func _Hello() MsgBox(0, "Hello", "How are you?") EndFunc Any help is appreciated. Thank you.
NewBie_2018 Posted November 28, 2018 Posted November 28, 2018 I have tried this I hope this is what you want expandcollapse popup#NoTrayIcon Opt('GUIOnEventMode', 1) Global $hGui = GUICreate("Dummy Gui", 0, 0, -200, -200, -1, 0, WinGetHandle(AutoItWinGetTitle())) GUISetState() Global $Context = GUICtrlCreateContextMenu(GUICtrlCreateDummy()) Global $step1 = GUICtrlCreateMenuItem("&step1", $Context) GUICtrlSetOnEvent(-1, '_Hello') GUICtrlCreateMenuItem("", $Context) Global $step2 = GUICtrlCreateMenu("&step2", $Context) Global $step2_1 = GUICtrlCreateMenuItem("&step2_1", $step2) GUICtrlSetOnEvent(-1, '_HowAreYou') GUICtrlCreateMenuItem("", $Context) Global $step3 = GUICtrlCreateMenu("&step3", $Context) Global $step3_1 = GUICtrlCreateMenuItem("&step3_1", $step3) Global $step3_2 = GUICtrlCreateMenuItem("&step3_2", $step3) TrackPopupMenu($hGui, GUICtrlGetHandle($Context), MouseGetPos(0), MouseGetPos(1)) ; 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 ;==>TrackPopupMenu Func _Hello() MsgBox(0, "Hello", "Hello") EndFunc Func _HowAreYou() MsgBox(0, "How Are You", "How Are You") EndFunc
MDCT Posted November 29, 2018 Author Posted November 29, 2018 Hi, thank you for trying to help me. But, that's not what I need tho. Basically, I need to incorporate different types of control into the menu, let's say Edit control or multiple icons and labels in a row inside the menu. I am thinking perhaps it is not possible, Perhaps creating custom menu with GUI and labels is the only way for this.
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