cornholio Posted February 11, 2007 Posted February 11, 2007 Hello, i'm new to this language. I've searched in the help chm for a way to change what happens when user clicks a button...i woould need some help plz..is it is possible
lekremyelsew Posted February 11, 2007 Posted February 11, 2007 In the help file there is a section under AutoIt called "GUI Reference" There are 2 ways to detect when a button is pressed, one is OnEvent mode and the other is MessageLoop mode, Look at them both and decide which one you want to use Hot Corners Rulez!
cornholio Posted February 11, 2007 Author Posted February 11, 2007 Thanks. I've read the examples from gui reference; good to know. What i want to do: being given a window not from a gui I made), I want to have my program in the background and, when a user click a specific button in that window, my program to show a message box(par example). I don't know how to react to an event from an outside window. I can though get the position of the button i want to catch and use some mouse events when the user clicks in that area, but i didn't find the events on mouse click, just functions to perform clicks and other mouse operations.
lekremyelsew Posted February 11, 2007 Posted February 11, 2007 If you want to do OnEvent Mode (I prefer it) At the begging of the script write a line of code: Opt("GUIOnEventMode",1) to set the mode to OnEvent After creating the control have a line of code: GUIControlSetOnEvent($button,"Function") to set the Event to the control Then define the function Func Function() MsgBox(0,"Title","Text") EndFunc Hot Corners Rulez!
Moderators SmOke_N Posted February 11, 2007 Moderators Posted February 11, 2007 WinExists() + WinActive() + ControlGetFocus() + _IsPressed() 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.
cornholio Posted February 11, 2007 Author Posted February 11, 2007 If you want to do OnEvent Mode (I prefer it) At the begging of the script write a line of code: Opt("GUIOnEventMode",1) to set the mode to OnEvent After creating the control have a line of code: GUIControlSetOnEvent($button,"Function") to set the Event to the control Then define the function Func Function() MsgBox(0,"Title","Text") EndFunc I did not create the control, and $button shoul be the controlID as returned by the fucntion GUICtrlCreate(..)..
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now