Jump to content

Mouse Over change Label


Go to solution Solved by jdelaney,

Recommended Posts

Posted

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.

Posted (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 by behdadsoft
Posted (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 by behdadsoft
Posted

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].

Posted

Post your latest code :)

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My 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

 

  • Solution
Posted

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.
Posted

 

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

 

 

Thanks, work fine. :)

Posted (edited)

behdadsoft,

A more flexible approach...

#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 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

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
  • Recently Browsing   0 members

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