Jump to content

Dynamic function for a dynamic menu?

Recommended Posts

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 submenu

GUICtrlSetOnEvent($MenuItemA[$guiscounter], "_menufunc_A")

The code

Global $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")

func _menufunc_A() 
msgbox (0, "", "The click was made on Gui.....")


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...