Jump to content
Sign in to follow this  

Detecting Mouse Click on an Element

Recommended Posts

Everyone on the forum has been really helpful here in the past, and so I thought I'd try tossing out another question for some direction (I'm still new at AutoIT, but learning!).

I've got a GUI that does a bunch of stuff, and in it, I've got an image file I'm using as a CANCEL button. Now, what I am trying to do is figure out how I can have my GUI run a bunch of tasks, but give the user an option to click CANCEL and abort the remaining tasks. I have everything working just fine, except the user can't abort the operation once they've initiated it.

How can I have something monitor my CANCEL button/control/label/GUI and detect when it's been pressed? I know I can use some built-in methods if it were an official button control, but I'm using GDI and parent/child GUIs to do some fancy visual stuff.

Here's a snippet of how I generate the CANCEL button on my controls GUI:

$hControlGUI = GUICreate("Button_ControlGUI", $iWidth, $iHeight, $iButtonX, $iButtonY, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $hGUI)
$hButton = GUICtrlCreateLabel("CANCEL", 0, 0, $iWidth, $iHeight)
SetBitmap($hControlGUI, $hButtonImage, $iOpacity)

Thanks in advance for any pointers in a direction to research!

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  

  • Create New...