[Gambas-user] Blinking

T Lee Davidson t.lee.davidson at gmail.com
Fri Apr 3 22:39:58 CEST 2020


On 4/3/20 4:31 PM, Gianluigi wrote:
> 
> 
> Il giorno ven 3 apr 2020 alle ore 21:39 Pino Zollo <pinozollo at gmail.com <mailto:pinozollo at gmail.com>> ha scritto:
> 
>     Is there any way to make a text or a label blinking ?
> 
> 
> You mean something like this?
> 
> Public hTimer As Timer
> Private $bText As Boolean
> Public Label1 As Label
> 
> Public Sub Form_Open()
> 
>    hTimer = New Timer As "Timer1"
>    hTimer.Delay = 300
>    hTimer.Enabled = True
>    Label1 = New Label(Me)
>    Label1.X = 120
>    Label1.Y = 50
>    Label1.H = 80
>    Label1.W = 240
>    Label1.Font = Font["Sans serif,16,bold"]
>    Label1.Foreground = Color.Red
>    Label1.Alignment = Align.Center
>    Label1.Text = "Blinking Text"
> 
> End
> 
> Public Sub Timer1_Timer()
> 
>    $bText = Not $bText
>    If $bText Then
>      Label1.Text = "Blinking Text"
>    Else
>      Label1.Text = ""
>    Endif
> 
> End
> 
> Regards
> Gianluigi
> 
> 
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
> 

You came up with the same concept of using a timer as I did, Gianluigi. Except, I implemented the blink a little differently.

' Gambas class file

Public Sub Form_Open()

   Timer1.Start

End

Public Sub Timer1_Timer()

   If Label1.Foreground = Color.Background Then
     Label1.Foreground = Color.Foreground
   Else
     Label1.Foreground = Color.Background
   Endif

End


-- 
Lee


More information about the User mailing list