Jump to content

Mouse Over change Label


Go to solution Solved by jdelaney,

Recommended Posts

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

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

 

Link to comment
Share on other sites

  • Solution

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.
Link to comment
Share on other sites

 

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. :)

Link to comment
Share on other sites

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

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