LarsJ Posted June 16, 2017 Posted June 16, 2017 (edited) Here you are: SSCtrlHover.7z And the example: #AutoIt3Wrapper_UseX64=y #include "SSCtrlHover_v3.au3" GUICreate(@AutoItVersion) $idLbl1 = GUICtrlCreateLabel("Label 1", 5, 5) SSCtrlHover_Register($idLbl1, "FnNormal", 0, "FnHover", 0, "FnActive", 0, "FnClick", 0) $idLbl2 =GUICtrlCreateLabel("Label 2", 5, 35) SSCtrlHover_Register($idLbl2, "FnNormal", 0, "FnHover", 0, "FnActive", 0, "FnClick", 5) GUISetState() While GUIGetMsg() <> -3 Sleep(10) WEnd Func FnNormal($idCtrl, $hWnd, $vData) ConsoleWrite(@CRLF & "Normal/Leave " & $idCtrl) EndFunc Func FnHover($idCtrl, $hWnd, $vData) ConsoleWrite(@CRLF & "Hover " & $idCtrl) EndFunc Func FnActive($idCtrl, $hWnd, $vData) ConsoleWrite(@CRLF & "Active " & $idCtrl) EndFunc Func FnClick($idCtrl, $hWnd, $vData) ConsoleWrite(@CRLF & "CLICK! " & $idCtrl & " - " & $hWnd & " - " & $vData) EndFunc Edited June 16, 2017 by LarsJ Deye 1 Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions
Deye Posted June 16, 2017 Posted June 16, 2017 Interesting, What would be the best way to add effects to this UDF like tinting ,set-transparency, or even manipulating an image(controlid) without the need to add more image resources for these modes (Hover,Select,Normal) ..
ura Posted June 29, 2017 Posted June 29, 2017 On 2017-6-17 at 2:03 AM, LarsJ said: 在这里你是:SSCtrlHover.7z 和例子: #AutoIt3Wrapper_UseX64 = Y #include “SSCtrlHover_v3.au3” GUICreate(@AutoItVersion) $ idLbl1 = GUICtrlCreateLabel(“标记1” , 5 , 5 ) SSCtrlHover _寄存器($ idLbl1 , “FnNormal” , 0 , “FnHover” , 0 , “FnActive” , 0 , “FnClick” , 0 ) $ idLbl2 = GUICtrlCreateLabel(“Label 2” , 5 , 35 ) SSCtrlHover _ Register($ idLbl2 , “FnNormal” , 0 , “FnHover” , 0 , “FnActive” , 0 , “FnClick” , 5 ) GUISetState() 而 GUIGetMsg() <> - 3 睡眠(10 ) WEnd Func FnNormal($ idCtrl , $ hWnd , $ vData ) ConsoleWrite(@CRLF & “Normal / Leave” & $ idCtrl ) EndFunc Func FnHover($ idCtrl , $ hWnd , $ vData ) ConsoleWrite(@CRLF & “Hover” & $ idCtrl ) EndFunc Func FnActive($ idCtrl , $ hWnd , $ vData ) ConsoleWrite(@CRLF & “Active” & $ idCtrl ) EndFunc Func FnClick($ idCtrl , $ hWnd , $ vData ) ConsoleWrite(@CRLF & “CLICK!” & $ idCtrl & “ - ” & $ hWnd & “ - ” & $ vData ) EndFunc Thank you so much
ura Posted July 9, 2017 Posted July 9, 2017 (edited) Please help! When the is down state, the cursor moves to other controls how to set the hover state? Edited July 9, 2017 by ura
borsTiHD Posted December 2, 2018 Posted December 2, 2018 (edited) Can be deleted... Edited December 16, 2018 by borsTiHD Can be deleted...
BlueSkyMemory Posted April 13, 2020 Posted April 13, 2020 Wow, It's a perfect UDF that can easily instead GUICtrlOnHover lol. I've been finding a way to solve my problem for a long time (I wrote one which uses SetWindowLog but the speed seems to be not very fast. Thank you very much!😊
ibecko Posted November 2, 2022 Posted November 2, 2022 hi, UDF cannot detect label over label ($idLbl0 on this case), what I can do to make it works? thanks expandcollapse popup#include "SSCtrlHover_v3.au3" #include <GUIConstants.au3> GUICreate(@AutoItVersion) $idBackgroundLabel = GUICtrlCreateLabel("", 5, 5, 200, 25) GUICtrlSetBkColor($idBackgroundLabel, 0xFFFFFF) $idLbl0 = GUICtrlCreateLabel("Label 0 over label not working", 5, 5, 200, 25) GUICtrlSetBkColor($idLbl0, $GUI_BKCOLOR_TRANSPARENT) SSCtrlHover_Register($idLbl0, "FnNormal", 0, "FnHover", 0, "FnActive", 0, "FnClick", 0) $idLbl1 = GUICtrlCreateLabel("Label 1", 5, 35, 200, 25) SSCtrlHover_Register($idLbl1, "FnNormal", 0, "FnHover", 0, "FnActive", 0, "FnClick", 0) $idLbl2 = GUICtrlCreateLabel("Label 2", 5, 70, 200, 25) SSCtrlHover_Register($idLbl2, "FnNormal", 0, "FnHover", 0, "FnActive", 0, "FnClick", 5) GUISetState() While GUIGetMsg() <> -3 Sleep(10) WEnd Func FnNormal($idCtrl, $hWnd, $vData) GUICtrlSetColor($idCtrl, 0x000000) ConsoleWrite(@CRLF & "Normal/Leave " & $idCtrl) EndFunc Func FnHover($idCtrl, $hWnd, $vData) GUICtrlSetColor($idCtrl, 0xFF0000) ConsoleWrite(@CRLF & "Hover " & $idCtrl) EndFunc Func FnActive($idCtrl, $hWnd, $vData) ConsoleWrite(@CRLF & "Active " & $idCtrl) EndFunc Func FnClick($idCtrl, $hWnd, $vData) ConsoleWrite(@CRLF & "CLICK! " & $idCtrl & " - " & $hWnd & " - " & $vData) EndFunc
ibecko Posted November 6, 2022 Posted November 6, 2022 (edited) I have solution on my case but I found problem with this UDF, x64 bit run/compile freeze with loop in function, on UDF vesion Posted June 16, 2017 not freeze but still not work, can anyone help? I need to compile x64 bit exe, thanks expandcollapse popup#include 'SSCtrlHover_v3.au3' #include <GUIConstants.au3> #include 'misc.au3' Opt('GUIOnEventMode', 1) Opt('GUICoordMode', 2) $Menu = GUICreate('Menu', 398, 88, -1, 200, $WS_POPUP + $WS_BORDER, $WS_EX_TOPMOST + $WS_EX_TOOLWINDOW + $WS_EX_NOACTIVATE) $idBackgroundLabel0 = GUICtrlCreateLabel('', 0, 0, 400, 30) GUICtrlSetBkColor($idBackgroundLabel0, $GUI_BKCOLOR_TRANSPARENT) SSCtrlHover_Register($idBackgroundLabel0, 'FnNormal', 0, 'FnHover', 0, 'Change_Value') $idLbl0 = GUICtrlCreateLabel(' Label 0 - click to change value', -1, -1, 400, 30, $SS_CENTERIMAGE) GUICtrlSetBkColor($idLbl0, $GUI_BKCOLOR_TRANSPARENT) $idBackgroundLabel1 = GUICtrlCreateLabel('', -1, 0, 400, 30) GUICtrlSetBkColor($idBackgroundLabel1, $GUI_BKCOLOR_TRANSPARENT) SSCtrlHover_Register($idBackgroundLabel1, 'FnNormal', 0, 'FnHover', 0, 'FnActive') $idLbl1 = GUICtrlCreateLabel(' Label 1', -1, -1, 400, 30, $SS_CENTERIMAGE) GUICtrlSetBkColor($idLbl1, $GUI_BKCOLOR_TRANSPARENT) $idBackgroundLabel2 = GUICtrlCreateLabel('', -1, 0, 400, 30) GUICtrlSetBkColor($idBackgroundLabel2, $GUI_BKCOLOR_TRANSPARENT) SSCtrlHover_Register($idBackgroundLabel2, 'FnNormal', 0, 'FnHover', 0, 'FnExit') $idLbl2 = GUICtrlCreateLabel(' Exit', -1, -1, 400, 30, $SS_CENTERIMAGE) GUICtrlSetBkColor($idLbl2, $GUI_BKCOLOR_TRANSPARENT) GUISetState(@SW_SHOWNOACTIVATE, $Menu) for $i = 0 to 0 step 0 if WinGetProcess(WinGetHandle('')) = @AutoItPID and _IsPressed('1B') then exit Sleep(10) next Func FnNormal($idCtrl, $hWnd, $vData) GUICtrlSetBkColor($idCtrl, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetColor($idCtrl+1, 0x000000) ConsoleWrite(@CRLF & 'Leave ' & $idCtrl) EndFunc Func FnHover($idCtrl, $hWnd, $vData) GUICtrlSetBkColor($idCtrl, 0x000000) GUICtrlSetColor($idCtrl+1, 0xFFFFFF) ConsoleWrite(@CRLF & 'Hover ' & $idCtrl) EndFunc Func FnActive($idCtrl, $hWnd, $vData) ConsoleWrite(@CRLF & 'Active ' & $idCtrl) EndFunc Func FnExit($idCtrl, $hWnd, $vData) exit EndFunc func Change_Value($Menu__Ctrl, $Menu__Hwnd, $vData) $Value = Input('Change value', '1000') ConsoleWrite(@CRLF & 'Change_value to ' & $Value) endfunc func Input($Title='', $InputFirstValue='') $Width = 172 $Height = 78 $Gui = GUICreate($Title, $Width, $Height, -1, 300, $WS_POPUP + $WS_BORDER) $GuiTitle = WinGetTitle($Gui) $GuiTitleBackground = GUICtrlCreateLabel('', 2, 2, 6, 24, -1, $GUI_WS_EX_PARENTDRAG) $GuiTitleLabel = GUICtrlCreateLabel($GuiTitle, 0, -1, $Width-6, -1, $SS_LEFT + $SS_CENTERIMAGE, $GUI_WS_EX_PARENTDRAG) $Input = GUICtrlCreateInput($InputFirstValue, 4-$Width, 0, $Width-(2*4), 20, $ES_CENTER + $ES_AUTOHSCROLL) $ButtonOk = GUICtrlCreateButton('OK', -1, 4, 80, 25, $BS_DEFPUSHBUTTON) GUICtrlSetOnEvent($ButtonOk, 'InputOk') $ButtonCancel = GUICtrlCreateButton('Cancel', 3, -1, 80, 25) GUICtrlSetOnEvent($ButtonCancel, 'InputDelete') GUICtrlSetState($Input, $GUI_FOCUS) GUISetState(@SW_SHOW, $Gui) Assign('Input__ButtonOkIsPressed__' &number($Gui), False, 2) Assign('Input__ButtonCancelIsPressed__'&number($Gui), False, 2) ;#comments-start ;WHEN DELETE LOOP WORKS FINE for $i = 0 to 0 step 0 if _IsPressed('1B') then GUIDelete($Gui) send('{esc up}') return False endif if Eval('Input__ButtonCancelIsPressed__'&number($Gui)) then Assign('Input__ButtonCancelIsPressed__'&number($Gui), False, 2) GUIDelete($Gui) return False endif if Eval('Input__ButtonOkIsPressed__'&number($Gui)) then Assign('Input__ButtonOkIsPressed__'&number($Gui), False, 2) $InputRead = GUICtrlRead($Input) GUIDelete($Gui) return $InputRead endif Sleep(10) next ;#comments-end ;WHEN DELETE LOOP WORKS FINE endfunc func InputDelete() Assign('Input__ButtonCancelIsPressed__'&number(@GUI_WinHandle), True, 2) endfunc func InputOk() Assign('Input__ButtonOkIsPressed__'&number(@GUI_WinHandle), True, 2) endfunc Edited November 14, 2022 by ibecko
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