Jump to content
Sign in to follow this  
Guest opa-gust

GuiGetMsg

Recommended Posts

Guest opa-gust

Hi, I'm a new user and working on my first script.

The problem is: I want to make a distinction between a normal click and a right-click.

For a right-click, the event $GUI_EVENT_SECONDARYDOWN seems appropriate,

but :

The description of the function GuiGetMsg in the Autoit Helpfile states:

The "event" returned is the control ID of the control sending the message, or it is a special event

So my question is : How to obtain both the control_id and the special event at the same time?

:whistle:

Share this post


Link to post
Share on other sites
seandisanti

Hi, I'm a new user and working on my first script.

The problem is: I want to make a distinction between a normal click and a right-click.

For a right-click, the event $GUI_EVENT_SECONDARYDOWN seems appropriate,

but :

The description of the function GuiGetMsg in the Autoit Helpfile states:

The "event" returned is the control ID of the control sending the message, or it is a special event

So my question is : How to obtain both the control_id and the special event at the same time? 

:whistle:

<{POST_SNAPBACK}>

tough call on this one. the GuiGetMsg only returns one or the other. one way you could kind of circumvent that would be to set a case that returns the control id from GuiGetMsg(), and also implements _IsPressed to check which if either of the mouse buttons are depressed.

Share this post


Link to post
Share on other sites
SumTingWong

This should do the trick.

#include <GUIConstants.au3>

GUICreate("Test")

$btn = GUICtrlCreateButton("Test", 20, 20)

GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    Switch $msg
    Case $GUI_EVENT_CLOSE
        ExitLoop
    Case $GUI_EVENT_SECONDARYDOWN
        $aCursorInfo = GUIGetCursorInfo()
        ConsoleWrite($btn & " - " & $aCursorInfo[4] & @LF)
    EndSwitch
WEnd
GUIDelete()
Edited by SumTingWong

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  

×