Jump to content

Updating a context menu...


ezzetabi
 Share

Recommended Posts

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? :)

Link to comment
Share on other sites

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 said

How 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 by scriptkitty

AutoIt3, the MACGYVER Pocket Knife for computers.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...