Sign in to follow this  
Followers 0
bucky002

Hovering button changes label.

3 posts in this topic

I remember seeing something like this when I first joined, but couldn't find it. What I need help with is. If I am hovering over button_1 that the label will change to button_1 or if I hover over button_3 the label will change to button_3 etc. I thought I remember the solution was either controlgetfocus or controlfocus. Here's an example GUI.

#include <GuiConstants.au3>

GuiCreate("MyGUI", 392, 117,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Button_1 = GuiCtrlCreateButton("Button1", 10, 20, 80, 40)
$Button_2 = GuiCtrlCreateButton("Button2", 130, 30, 80, 40)
$Button_3 = GuiCtrlCreateButton("Button3", 260, 30, 110, 40)
$Label_4 = GuiCtrlCreateLabel("Label4", 20, 90, 340, 20)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
        ;;;
    EndSelect
WEnd
Exit

Share this post


Link to post
Share on other sites



something like this ?

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)

GUICreate("Get Pos", 400, 400)

$btn1 = GUICtrlCreateButton("test",40,40,80,40)

$btn2 = GUICtrlCreateButton("ok",40,120,80,40)

GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSE")

GUISetState()

While 1

sleep(100)

GetPos()

sleep(100)

WEnd

Exit

Func GetPos()

$a=GUIGetCursorInfo()

Select

Case $a[4] = 3

GUIctrlSetData($btn1,"huh?")

Case $a[4] = 4

GUIctrlSetData($btn2,"not ok")

case Else

GUIctrlSetData($btn1,"test")

GUIctrlSetData($btn2,"ok")

EndSelect

EndFunc

Func close()

Exit

EndFunc

Share this post


Link to post
Share on other sites

That works great. Thanks.

Share this post


Link to post
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
Sign in to follow this  
Followers 0