ezzetabi Posted November 21, 2004 Posted November 21, 2004 How can I update a context menu items if I can not delete the control and recreate it? I'd like to make a context menu with a list of all active processes. Of course the list should be done on the fly when the users clicks. But my script as now will just adds a second list in the front of the old one! How can I replace it?
scriptkitty Posted November 21, 2004 Posted November 21, 2004 (edited) I just delete the individual one to replace it, but maybe you mean something different. This example changes it when hotkey is pressed.I know you saidHow can I update a context menu items if I can not delete the control and recreate it?I will look to see if I can update the control in some other way, maybe command control or something.GUICreate("My GUI Context Menu",300,200) #include "GUIConstants.au3" HotKeySet("{PAUSE}","TESTER") $contextmenu = GUICtrlCreateContextMenu () $newsubmenu = GUICtrlCreateMenu ("new", $contextmenu) $textitem = GUICtrlCreateMenuitem ("text",$newsubmenu) $fileitem = GUICtrlCreateMenuitem ("Open",$contextmenu) $saveitem = GUICtrlCreateMenuitem ("Save",$contextmenu,1) GUICtrlCreateMenuitem ("",$contextmenu) ; separator $infoitem = GUICtrlCreateMenuitem ("Info",$contextmenu) GUISetState () ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop Wend FUNC TESTER() GUICtrlDelete ($saveitem ) $saveitem = GUICtrlCreateMenuitem ("Save On close",$contextmenu,1) ToolTip($SAVEITEM) EndFunc Edited November 21, 2004 by scriptkitty AutoIt3, the MACGYVER Pocket Knife for computers.
ezzetabi Posted November 21, 2004 Author Posted November 21, 2004 Thanks scriptkitty. I used this, for seeing actually the menu changing... FUNC TESTER() GUICtrlDelete ($saveitem ) $saveitem = GUICtrlCreateMenuitem (Random(),$contextmenu,1) ToolTip($SAVEITEM) EndFunc
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