topten Posted November 19, 2015 Posted November 19, 2015 I create dynamic gui with dynamic menus. This way I can create 10-20 guis and all of them will have that context menus. The menuitem I correspond to some function. Is there a way for that function (menufunc_A) to determine that the click was made from the certain window, say from window $DynGui[1] or $DynGui[2] ? If there is no way, please give me a hint how to deal with those "dynamic functions" for submenuGUICtrlSetOnEvent($MenuItemA[$guiscounter], "_menufunc_A")The codeGlobal $guiscounter = 0 Global $DynGui[10000] Global $ContextMenu[10000] Global $MenuItemA[10000] $DynGui[$guiscounter] = GUICreate("Test Gui", $iWidth, $iHeight, $WS_POPUP) ;create a test GUI $ContextMenu[$guiscounter] = GUICtrlCreateContextMenu($DynGui[$guiscounter]) $MenuItemA[$guiscounter] = GUICtrlCreateMenuItem("A", $ContextMenu[$guiscounter]) GUICtrlSetOnEvent($MenuItemA[$guiscounter], "_menufunc_A") GUISetState(@SW_SHOW)func _menufunc_A() msgbox (0, "", "The click was made on Gui.....") endfunc
ahmet Posted November 19, 2015 Posted November 19, 2015 Try the following code func _menufunc_A() msgbox (0, "", "The click was made on Gui" & @GUI_WinHandle) endfuncThere is a nice example in help file for GUICtrlSetOnEvent.
topten Posted November 19, 2015 Author Posted November 19, 2015 Thanx a lot Ahmet. Your help is preicious
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