Jump to content
Sign in to follow this  
SYRAU3

How to use the right (secondary) mouse button with controls

Recommended Posts

SYRAU3

Hi all, how to use the secondary mouse button instead of the primary?

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 262, 173, 192, 124)
$Button1 = GUICtrlCreateButton("Button1", 96, 64, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
  Case $Button1
   GUICtrlDelete($Button1)
EndSwitch
WEnd

for example, i need the button control to get deleted when the secondary mouse button is clicked on it.

Share this post


Link to post
Share on other sites
Zedna

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>

$Form1 = GUICreate("Form1", 262, 173, 192, 124)
$Button1 = GUICtrlCreateButton("Button1", 96, 64, 75, 25)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
      Case $GUI_EVENT_CLOSE
       Exit
    EndSwitch

    $info = GUIGetCursorInfo()
    If $info[4] = $Button1 And $info[3] = 1 Then GUICtrlDelete($Button1)
WEnd

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  

×