Ontosy

GUI_EVENT_SECONDARYDOWN

11 posts in this topic

Why when use

GUISetOnEvent($GUI_EVENT_SECONDARYDOWN, "SpecialEvents"

not work? for example this.

Share this post


Link to post
Share on other sites



It works.

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
    Opt("GUIOnEventMode", 1)

    GUICreate("Parent1")
    GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")
    GUISetOnEvent($GUI_EVENT_SECONDARYDOWN, "SpecialEvents")


    GUISetState(@SW_SHOW)

    ; Just idle around
    While 1
        Sleep(10)
    WEnd
EndFunc   ;==>Example

Func SpecialEvents()
    Select
        Case @GUI_CtrlId = $GUI_EVENT_CLOSE
            MsgBox($MB_SYSTEMMODAL, "Close Pressed", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)

            GUIDelete()
            Exit
        Case @GUI_CtrlId = $GUI_EVENT_SECONDARYDOWN
            MsgBox($MB_SYSTEMMODAL, "Secondary CLICK", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)

    EndSelect
EndFunc   ;==>SpecialEvents

Saludos

Share this post


Link to post
Share on other sites

Why not for me in Windows 10?

Share this post


Link to post
Share on other sites

Did you try any debugging and see if SpecialEvents was even getting called?

Func SpecialEvents()
    ConsoleWrite("SpecialEvents called" & @LF)
    Switch (@GUI_CtrlId)
        Case $GUI_EVENT_CLOSE
            MsgBox($MB_SYSTEMMODAL, "Close Pressed", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)

            GUIDelete()
            Exit
        Case $GUI_EVENT_SECONDARYDOWN
            MsgBox($MB_SYSTEMMODAL, "Secondary CLICK", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)

    EndSwitch
EndFunc   ;==>SpecialEvents

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

added $GUI_EVENT_PRIMARYDOWN:

$GUI_EVENT_CLOSE and $GUI_EVENT_PRIMARYDOWN called.

$GUI_EVENT_SECONDARYDOWN not called.

Edited by Ontosy

Share this post


Link to post
Share on other sites
10 hours ago, Ontosy said:

Why not for me in Windows 10?

I tested in windows 10 x64 . It's ok.

 

Saludos

Share this post


Link to post
Share on other sites

Why not work for me?

Share this post


Link to post
Share on other sites

Show your script, Danyfirex script works for me on Win10 x64

Share this post


Link to post
Share on other sites

The script is same that Danyfirex:

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
    Opt("GUIOnEventMode", 1)

    GUICreate("Parent1")
    GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")
    GUISetOnEvent($GUI_EVENT_SECONDARYDOWN, "SpecialEvents")
    GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "SpecialEvents")


    GUISetState(@SW_SHOW)

    ; Just idle around
    While 1
        Sleep(10)
    WEnd
EndFunc   ;==>Example

Func SpecialEvents()
    ConsoleWrite("SpecialEvents called" & @LF)
    Switch (@GUI_CtrlId)
        Case $GUI_EVENT_CLOSE
            MsgBox($MB_SYSTEMMODAL, "Close Pressed", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)

            GUIDelete()
            Exit
        Case $GUI_EVENT_PRIMARYDOWN
            MsgBox($MB_SYSTEMMODAL, "Secondary CLICK", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)
        Case $GUI_EVENT_SECONDARYDOWN
            MsgBox($MB_SYSTEMMODAL, "Secondary CLICK", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)

    EndSwitch
EndFunc   ;==>SpecialEvents

I also have same problem in other pc with Win7 x64.

Primary work secondary not.

Share this post


Link to post
Share on other sites

This script also working, but you forgot to edit line 32 to display the right message.

May be some app is hooking your mouse and destroy the event? Did your secondary mousebutton work in other applications? 

1 person likes this

Share this post


Link to post
Share on other sites

I have fixed line 32.

secondary mousebutton work in other applications but i have found that it also have conflict with other application. ty.

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