Jump to content
Sign in to follow this  
Nova

Disable/Enable a ContextMenu

Recommended Posts

Nova

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.

Share this post


Link to post
Share on other sites
layer

you do have the actuall loop right? not just sleep(10)

EDIT: my mistake, ive never used OnEvent mode before, sorry o:) hmmm :lmao:

Edited by layer

FootbaG

Share this post


Link to post
Share on other sites
Nova

you do have the actuall loop right? not just sleep(10)

Lol nope , Tnx Layer but in future plz dont post a blind guess :lmao:

Share this post


Link to post
Share on other sites
jpm

Lol nope , Tnx Layer but in future plz dont post a blind guess  o:)

<{POST_SNAPBACK}>

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

Share this post


Link to post
Share on other sites
Nova

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.

Share this post


Link to post
Share on other sites
jpm

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:

Share this post


Link to post
Share on other sites
BlankMind

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

Share this post


Link to post
Share on other sites
jpm

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:

Share this post


Link to post
Share on other sites
BlankMind

You have to download the beta version to access to GUI functions :lmao:

<{POST_SNAPBACK}>

I've already done this and I'm learning GUI functions, thank you for helping o:)

Share this post


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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.