Sign in to follow this  
Followers 0
taurus905

Right-click on button and change focus

3 posts in this topic

Is it possible to right-click on a button inside a gui and get it to change focus to that button?

I am using the following:

GUISetOnEvent($GUI_EVENT_SECONDARYDOWN, "_sys_event_handler", $gui)

But I am not sure how to detect which button is being right-clicked on.

Thanks,

taurus905


"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

Share this post


Link to post
Share on other sites



#include <guiconstants.au3>
Opt('GUIOnEventMode', 1)

Global $BUTTON[6]
$MAIN_GUI = GUICreate('TEST', 270, 50)
For $i_Count = 1 To UBound($BUTTON) - 1
    $BUTTON[$i_Count] = GUICtrlCreateButton('Button ' & $i_Count, 10 + (($i_Count - 1) * 50), 10, 50, 30)
Next

GUISetOnEvent($GUI_EVENT_SECONDARYDOWN, "_sys_event_handler", $MAIN_GUI)
GUISetOnEvent(-3, "_Exit", $MAIN_GUI)

GUISetState()
While 1
    Sleep(10000)
WEnd

Func _sys_event_handler()
    Local $GetCursor = GUIGetCursorInfo($MAIN_GUI)
    ControlFocus($MAIN_GUI, '', $GetCursor[4])
EndFunc

Func _Exit()
    Exit
EndFunc


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

SmOke_N,

Thank you sir.

GUIGetCursorInfo was exactly what I needed. :D

taurus905


"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

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