Jump to content

Disable/Enable a ContextMenu


Nova
 Share

Recommended Posts

Why dosent the following work ?

#include <GUIConstants.au3>
Opt("GuiOnEventMode", 1) 

GUICreate("My GUI Context Menu",300,200)

$contextmenu = GUICtrlCreateContextMenu ()

$button = GUICtrlCreateButton("OK",100,100,70,20)
GUICtrlSetOnEvent($button, "Contextmenu_disable")

$buttoncontext = GUICtrlCreateContextMenu($button)
$buttonitem = GUICtrlCreateMenuitem("About button",$buttoncontext)


GUISetState ()

Func Contextmenu_disable()
    GUICtrlSetState ( $contextmenu, $Gui_Disable)
EndFunc

While 1
   sleep (10)
WEnd

Im trying to make it so that when the button is pressed the context menu no longer appears.

Link to comment
Share on other sites

Contextmenu cannot have state change just delete and recreate if needed.

From help file GUICtrlDelete

This function does not currently work on context menu controls.

I really need to be able to hide/show a context menu, is there any change autoit could be edited to allow this ?

I use this method alot with other ctrls, I create them at the start of my script and hide them, then later on unhide them from within functions.

If you cant understand my need im sure I can write you a script to explain it better.

Link to comment
Share on other sites

From help file GUICtrlDelete

I really need to be able to hide/show a context menu, is there any change autoit could be edited to allow this ?

I use this method alot with other ctrls, I create them at the start of my script and hide them, then later on unhide them from within functions.

If you cant understand my need im sure I can write you a script to explain it better.

<{POST_SNAPBACK}>

I can really understand your need.

But ContextMenu are design in a such a way (Holger can confirm) that only GuiCtrlDetelete can be use to have a correct handling.

The best can be you design a fonction with create the contextmenu you can recall when you want to have it back.

Sorry for not having a more simpler solution to your problem :lmao:

Link to comment
Share on other sites

Just another question: What's this "GUICreate" that you always says in forum? I haven't found anything about it on AutoIT3 documentation.

<{POST_SNAPBACK}>

You have to download the beta version to access to GUI functions :lmao:
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...