Code: Select all
Enumeration
#WIN
#Affiche
#gadgetone
EndEnumeration
Structure stFlashError
count.i
gadget.i
EndStructure
Global muFlash.i = CreateMutex()
Global NewList gFlash.stFlashError()
Procedure FlashError( a.l, b.l, dwUser.l, d.l, E.i )
Protected uDelay.i
If TryLockMutex( muFlash )
ChangeCurrentElement( gFlash(), dwUser )
gFlash()\count - 1
uDelay = gFlash()\count * 15
If uDelay < 125 : uDelay = 125 : EndIf
If gFlash()\count % 2
SetGadgetColor( gFlash()\gadget, #PB_Gadget_BackColor, $E81717 )
Else
SetGadgetColor( gFlash()\gadget, #PB_Gadget_BackColor, -1 )
EndIf
If gFlash()\count > 0
timeSetEvent_( uDelay, 50, @FlashError(), dwUser, #TIME_ONESHOT )
EndIf
UnlockMutex( muFlash )
EndIf
EndProcedure
If OpenWindow(#WIN, 450, 200, 377, 24, "clignote", #PB_Window_SystemMenu|#PB_Window_TitleBar)
StringGadget(#Affiche, 0, 0, 375, 22, "My Text", #PB_String_ReadOnly)
EndIf
LockMutex( muFlash )
AddElement( gFlash() )
gFlash()\count = 16
gFlash()\gadget = #Affiche
d = @gFlash()
UnlockMutex( muFlash )
timeSetEvent_( 25, 10, @FlashError(), d, #TIME_ONESHOT )
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Select EventWindow()
Case #WIN
CloseWindow(#WIN)
Break
EndSelect
EndSelect
ForEver