behdadsoft Posted October 30, 2014 Posted October 30, 2014 (edited) Hi. I create a label in my GIU and I want when mouse over on the button change label text. how can do it? Thanks. Edited October 30, 2014 by behdadsoft
Radiance Posted October 30, 2014 Posted October 30, 2014 Hi, check out GUIGetCursorInfo(). Use it in a function with AdLibRegister that compares the ID of your control to $array[4] you get from GUIGetCursorInfo every 100 ms.
Radiance Posted October 30, 2014 Posted October 30, 2014 https://www.autoitscript.com/autoit3/docs/functions/AdlibRegister.htm You can set a function that is called over and over again until you use AdLibUnregister on it.
behdadsoft Posted October 30, 2014 Author Posted October 30, 2014 (edited) Thanks Edited October 30, 2014 by behdadsoft
behdadsoft Posted October 30, 2014 Author Posted October 30, 2014 (edited) there is a problem when I use Switch---Case for Check my GUIGetCursorInfo() value give me an error when click on Desktop. Func CheckGUI_ID () Local $GUI_ID = GUIGetCursorInfo() Switch $GUI_ID [4] Case 0 GUICtrlSetData ($GUILabel, "Ready") Case 3 GUICtrlSetData ($GUILabel, "My Computer") EndSwitch EndFunc Please Guide Me. Edited October 30, 2014 by behdadsoft
mikell Posted October 30, 2014 Posted October 30, 2014 ? Func CheckGUI_ID () Local $GUI_ID = GUIGetCursorInfo($GUI) Switch $GUI_ID[4] Case $GUILabel GUICtrlSetData ($GUILabel, "My Computer") Case Else GUICtrlSetData ($GUILabel, "Ready") EndSwitch EndFunc
behdadsoft Posted October 30, 2014 Author Posted October 30, 2014 (edited) use Case Else don't fix problem. I think Problem is relate to [4] at $GUI_ID [4]. because when I remove [4] make fix the Problem but switch---Case don't work. Edited October 30, 2014 by behdadsoft
behdadsoft Posted October 30, 2014 Author Posted October 30, 2014 I used GUIGetCursorInfo($GUI) and make fix problem relate to close my GUI when click on Desktop. but when I compile My Script and run it Give me below error: Error: Subscript used on non-accessible variable. I think this error is relate to $GUI_ID [4].
MikahS Posted October 30, 2014 Posted October 30, 2014 Post your latest code Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ
behdadsoft Posted October 30, 2014 Author Posted October 30, 2014 Func CheckGUI_ID () Local $GUI_ID = GUIGetCursorInfo($GUI) Switch $GUI_ID [4] Case 3 GUICtrlSetData ($GUILabel, "Hello") Case 4 GUICtrlSetData ($GUILabel, "Bye") Case Else GUICtrlSetData ($GUILabel, $DefaultLabelText) EndSwitch EndFunc
Solution jdelaney Posted October 30, 2014 Solution Posted October 30, 2014 error handling required: Func CheckGUI_ID () Local $GUI_ID = GUIGetCursorInfo($GUI) If Not @error Then Switch $GUI_ID [4] Case 3 GUICtrlSetData ($GUILabel, "Hello") Case 4 GUICtrlSetData ($GUILabel, "Bye") Case Else GUICtrlSetData ($GUILabel, $DefaultLabelText) EndSwitch EndIf EndFunc IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
behdadsoft Posted October 30, 2014 Author Posted October 30, 2014 error handling required: Func CheckGUI_ID () Local $GUI_ID = GUIGetCursorInfo($GUI) If Not @error Then Switch $GUI_ID [4] Case 3 GUICtrlSetData ($GUILabel, "Hello") Case 4 GUICtrlSetData ($GUILabel, "Bye") Case Else GUICtrlSetData ($GUILabel, $DefaultLabelText) EndSwitch EndIfEndFunc Thanks, work fine.
kylomas Posted October 30, 2014 Posted October 30, 2014 (edited) behdadsoft, A more flexible approach... expandcollapse popup#include <GUIConstantsEx.au3> #include <StaticConstants.au3> #AutoIt3Wrapper_Add_Constants=n local $gui010 = guicreate('') local $aSize = wingetclientsize($gui010) local $lbl010 = guictrlcreatelabel('',0,020,$aSize[0],50,$ss_sunken) local $lbl020 = guictrlcreatelabel('',0,100,$aSize[0],50,$ss_sunken) guisetstate() $aCSR = GUIGetCursorInfo($gui010) while 1 switch guigetmsg() case $gui_event_close Exit EndSwitch _on_hover($lbl010) _on_hover($lbl020) WEnd func _on_hover($ctlid) local static $last_ctlid switch GUIGetCursorInfo($gui010)[4] case $ctlid GUICtrlSetBkColor($ctlid,0xff0000) $last_ctlid = $ctlid case else if $last_ctlid = $ctlid then GUICtrlSetBkColor($ctlid,0x550000) $last_ctlid = 0 endif endswitch endfunc kylomas edit: spelling Edited October 30, 2014 by kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
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