JoneZ Posted July 28, 2006 Posted July 28, 2006 Hi I've only discoverd AutoIt this week and i must say it is awsome!!! I'm trying to change the colour of a label when i move my mouse over it. So far i've got it to work when i click on the label. I need to be able to hover over the label. How do i do this. ; LABEL $label1=GuiCtrlCreateLabel(@CRLF & "Open File", 40, 40, 360, 40, $SS_SUNKEN ) GuiCtrlSetBkColor(-1, 0xece9d8) GUICtrlSetOnEvent($label1,"Label1Click") Func Label1Click() GuiCtrlSetBkColor($label1, 0xFFFFCC) EndFunc Thanks in advance
Xenobiologist Posted July 28, 2006 Posted July 28, 2006 HI, there is a MouseHover udf in Scripts & Scrapts. So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
Moderators SmOke_N Posted July 28, 2006 Moderators Posted July 28, 2006 (edited) #include <guiconstants.au3> Opt('GUIOnEventMode', 1) Global $MainLabelColour = 0xECE9D8, $OverLabelColour = 0xFFFFCC, $MouseOver = 1 $MainGUI = GUICreate('Test', 440, 120) $label1 = GUICtrlCreateLabel(@CRLF & "Open File", 40, 40, 360, 40, $SS_SUNKEN ) GUICtrlSetBkColor(-1, $MainLabelColour) GUISetOnEvent($GUI_EVENT_CLOSE, '_Exit', $MainGUI) AdlibEnable("_AdlibManager", 10) GUISetState() While 1 Sleep(10000) WEnd Func _AdlibManager() _LabelOver($MainGUI, $label1) EndFunc Func _LabelOver($hMainWnd, $hControl) Local $aGetCursor = GUIGetCursorInfo($MainGUI) If $MouseOver and $aGetCursor[4] = $hControl Then GUICtrlSetBkColor($hControl, $OverLabelColour) $MouseOver = 0 ElseIf Not $MouseOver And Not $aGetCursor[4] = $hControl Then GUICtrlSetBkColor($hControl, $MainLabelColour) $MouseOver = 1 EndIf EndFunc Func _Exit() Exit 0 EndFunc Edited July 28, 2006 by SmOke_N 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.
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