Hello.
I can't figure out how to make my button in the GUI do one function when pressing LButton, and another when pressing RButton.
When adding RButton::, the function extends to the entire GUI and it works globally in windows, and I only need a button.
Different functions on RButton and LButton Topic is solved
Re: Different functions on RButton and LButton
Hallo,
in what gui? Reduce your script to the parts that don't behave as you want and show us.
in what gui? Reduce your script to the parts that don't behave as you want and show us.
Re: Different functions on RButton and LButton
Here is an example of how I can force Rbutton to perform a function only when my cursor is on the button and Rbutton is pressed.
When I click Rbutton, it works globally.
When I click Rbutton, it works globally.
Code: Select all
Gui, Add, Button, gBut1 vButton3, Button
Gui, Show, w100 h100
Return
But1:
MsgBox, hello1
return
RButton::
MsgBox, hello2
return
GuiClose:
ExitApp
Re: Different functions on RButton and LButton
If the gui has the focus, then:
Otherwise a global RButton-Hotkey could check with MouseGetPos over which window it is located.
Code: Select all
Gui, Add, Button, gBut1 vButton3, Button
Gui, Show, w100 h100
Return
But1:
MsgBox, hello1
return
#IFWinActive, ahk_class AutoHotkeyGUI
RButton::MsgBox, hello2
#IF
GuiClose:
ExitApp
Re: Different functions on RButton and LButton
maybe there are examples?, I read the help on MousesGetPost, but I didn't understand anything at all
Re: Different functions on RButton and LButton Topic is solved
Try:
Code: Select all
Gui, +HwndMyGui
Gui, Add, Button, gBut1 vButton3, Button
Gui, Show, w100 h100
Return
But1:
MsgBox, hello1
return
GuiClose:
ExitApp
RButton::
MouseGetPos,,, Win, Control
IF (Win = MyGui) And (Control = "Button1")
MsgBox, hello2
Else
Click Right
Return
Re: Different functions on RButton and LButton
Thank you very much