Sign in to follow this  
Followers 0
nss

help with activating context menu or menu on a button click or by using accelerators

2 posts in this topic

Hi all,

I am working on a project, in which I decided I should have history of previously searched stuff (since it's an app with which you can search stuff), so I have been thinking that I could just create the context menu or regular menu, that I could somehow force to activate on a button click or by using accelerators.

Now, I haven't been able to figure out how to make that work.

First I tried guiCtrlSetState, which didn't seem to work (I tried show and focus), then I tried accelerators and they didn't do anything.

So I'm wondering is there any way I can make the context menu or regular menu pop up on button press/click or key press (with accelerators)?

I know I can be old school and use a new gui, or just a combo box for the history or anything but I kinda want this, if there's any way to do so.

Any help, or an alternative way of doing the same thing appreciated :)

Here's the testing code in which I was trying to make the test button trigger and activate the context menu, and I have tried the same with the regular menu:

«

#notrayicon
#include <GUIConstantsEx.au3>
guicreate("test123")
$but=guictrlcreatebutton("test", -1, -1, -1)
$xt=GUICtrlCreateContextMenu("test context menu")
GUICtrlCreateMenuItem("test1", $xt)
GUICtrlCreateMenuItem("test2", $xt)
guisetstate(@SW_MAXIMIZE)
while 1
sleep(5)
$msg=GUIGetMsg()
if $msg=$but then
guictrlsetstate($xt, $GUI_FOCUS)
endif
wend

»

Share this post


Link to post
Share on other sites



so, to clarify, I want basically to be able to open the context menu on left click/on key press on the button, currently I'm using controlClick function, but if there's another way I'd love to  do it the other way

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  
Followers 0