Jump to content

Autoit Hover Effect


Recommended Posts

Use GUIGetCursorInfo:

Quote

Success: a five-element array that containing the mouse cursor information:
    $aArray[0] = X coord (horizontal)
    $aArray[1] = Y coord (vertical)
    $aArray[2] = Primary down (1 if pressed, 0 if not pressed)
    $aArray[3] = Secondary down (1 if pressed, 0 if not pressed)
    $aArray[4] = ID of the control that the mouse cursor is hovering over (or 0 if none)

to build your own or search in: https://www.autoitscript.com/forum/forum/9-autoit-example-scripts/

i have build my own :

;==================================================================================================
; Function Name:    _GuiCtrlPic_CheckHoverDisabled($hGui, ByRef $aHoverBtn)
; Description:      prüft den Status ein PicControls Enabled/Disabled Hovered/Normal
;                   und setzt bei Statusänderung das dazugehörige Pic
; Parameter(s):     $hGui       Handle der GUI
;                   $aHoverBtn  2D-Array der HoverButtons ua mit Pfaden zu den Pics
; Author:           autoBert
;                   getestet mit 3.3.14.1
;==================================================================================================
Func _GuiCtrlPic_CheckHoverDisabled($hGui, ByRef $aHoverBtn)
    Local $aInfo = GUIGetCursorInfo($hGui), $iNewState
    For $i = 0 To UBound($aHoverBtn) - 1
        $iNewState = $aHoverBtn[$i][5]
        If BitAND(GUICtrlGetState($aHoverBtn[$i][0]), $Gui_DISABLE) = $Gui_DISABLE Then
            If $aHoverBtn[$i][5] <> 4 Then $iNewState = 4 ;disabled
        Else
            If $aInfo[4] = $aHoverBtn[$i][0] Then
                If $aHoverBtn[$i][5] <> 2 Then $iNewState = 2 ;hovered
            Else
                If $aHoverBtn[$i][5] <> 1 Then $iNewState = 1 ;normal
            EndIf
        EndIf
        If $iNewState <> $aHoverBtn[$i][5] Then
            _GUICtrlPic_SetImage($aHoverBtn[$i][0], $aHoverBtn[$i][$iNewState], True)
            ;ConsoleWrite('Error: '&@error&' Button: '&$i&' aktiv: '& ($aInfo[4]= $aHoverBtn[$i][0])&' -> ' &$aHoverBtn[$i][5]&' '&$iNewState&@CRLF)
        EndIf
        $aHoverBtn[$i][5] = $iNewState
    Next
EndFunc   ;==>_GuiCtrlPic_CheckHoverDisabled

for using with _GUICtrlPic_Create

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...