Sign in to follow this  
Followers 0
highnuu

How To Make Gui-label Blinking ?

3 posts in this topic

Hello,

i'm looking for solution to make blinking a GUICreate'd label:

I create a GUI with GUICreate, the a label with GUICtrlCreateLabel and set the color with GUICtrlSetColor.

A button for end the color changing is created also.

The following code come from me, but the interaction with the button to disable blinking is not usefull....

because i use Sleep() to show the color changing, it necessary to click button much more for check the event.

If i don't use sleep....the $msg=$button-event works fine....but i don't see the color changing!

How can i make this subroutine works fine ?

$guiid=GUICreate ("aktive MSN: " & $old_number & " (!)" ,170,50,$x,$y,$WS_TILED + $DS_CONTEXTHELP + $DS_SETFOREGROUND,$WS_EX_TOPMOST)
        Opt("GUICoordMode",2)
        $guictrid=GUICtrlCreateLabel ("Anruf von: " & $lastcall,  3, 4, 144)    
        GUICtrlSetColor(-1,0xff0000)   ; red
        GUICtrlSetTip($guictrid,$lastcallinfo);TipTExt (Mouseover)
    ;create button for end blinking label
        $button_1 = GUICtrlCreateButton ("X", 0, -1, 15, 15)
        GUICtrlSetState($button_1,$GUI_ENABLE)
        GUISetState(@SW_SHOW)
            
        Do
            
        $msg=GUIGetMsg()
        ;blinking text
            GUICtrlSetColor($guictrid,0xffffff)   ; white
            GUICtrlSetState($guictrid,$GUI_SHOW)
            Sleep (500)
            GUICtrlSetColor($guictrid,0xff0000)   ; red
            GUICtrlSetState($guictrid,$GUI_SHOW)
            Sleep (500)
                    
        Until $msg = $button_1
    ;color to red
                GUICtrlSetColor($guictrid,0xff0000)   ; red
                GUICtrlSetState($guictrid,$GUI_SHOW)
            ;button disable
                GUICtrlSetState($button_1,$GUI_DISABLE)

Thanks for help

regards

highnuu

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

This question should of been posted in support.

#include <GUIConstants.au3>
$GUI = GUICreate("Text Blink", 500, 500)
$s_text = "This is your blinking Text"
$RED = 1
$lbl_text = GUICtrlCreateLabel($s_text, 10, 10, 480, 17, $SS_SUNKEN)
GUICtrlSetColor($lbl_text,0xff0000)  ; Red
GUICtrlSetFont($lbl_text,9,700)

GUISetState(@SW_SHOW)
$sec = @SEC
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
        If @SEC <> $sec Then
            $sec = @SEC
            If $RED Then
                GUICtrlSetColor($lbl_text,0xffffff)
            Else
                GUICtrlSetColor($lbl_text,0xff0000)
            EndIf
            $RED = Not $RED
        EndIf
    EndSelect
WEnd
Exit
Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

This question should of been posted in support.

#include <GUIConstants.au3>
$GUI = GUICreate("Text Blink", 500, 500)
$s_text = "This is your blinking Text"
$RED = 1
$lbl_text = GUICtrlCreateLabel($s_text, 10, 10, 480, 17, $SS_SUNKEN)
GUICtrlSetColor($lbl_text,0xff0000) ; Red
GUICtrlSetFont($lbl_text,9,700)

GUISetState(@SW_SHOW)
$sec = @SEC
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
        If @SEC <> $sec Then
            $sec = @SEC
            If $RED Then
                GUICtrlSetColor($lbl_text,0xffffff)
            Else
                GUICtrlSetColor($lbl_text,0xff0000)
            EndIf
            $RED = Not $RED
        EndIf
    EndSelect
WEnd
Exit
Hi *gafrost*,

many thanks - that's it...works very well....

great support in this forum :)

regards

Highnuu

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