Page loading

Share your opinion
What do you think about gambaslinux.fr?
 
Interesting
It miss some informations
Excellent website
Results
WIDGETS GAMBAS
GAMBAS 3 SOFTWARES
TUTORIALS
Library
TIMER - Trigger
French only sorry...
UTILISATION D'UN TRIGGER


mytimer.png
Bonjour,
aujourd'hui nous allons nous intéresser aux différentes actions du timer

Pour démarrer un timer vous avez deux possibilités :

Soit vous utilisez la commande : Timer1.start()
soit vous modifiez la propriété du timer comme ceci : Timer1.enabled = TRUE

Pour Arrêter un timer faite de même avec la commande : Timer1.Stop()
ou utilisez la propriété Timer1.Enabled = FALSE

Lors d'un démarrage d'un Timer, le programme exécutera en boucle tout ce qui se trouve dans la fonction :
 
PUBLIC SUB Timer1_Timer()
'contenu de ma fonction
END

Ainsi si vous ajoutez :
mavariable = mavariable + 1
print mavariable

dans la boucle, où verrez votre variable s'incrémenter d'un toutes les x temps.

Ce temps x peut être configuré à l'aide de la propriété DELAY avec comme exemple :

Timer1.Delay = 1000
soit 1000 millisecondes soit 1 seconde.

Une autre fonction intéressante est le TRIGGER, qui vous permet de déclencher la boucle manuellement.
Vous pourrez apprécier le fonctionnement d'un trigger avec ce petit exemple en GB2.
Bonne semaine à tous

TELECHARGER L'EXEMPLE ICI


Code source de l'exemple :
' Gambas class file
PRIVATE numberloop AS Integer = 0

PUBLIC SUB _new()

END

PUBLIC SUB Form_Open()
ME.Center
END

PUBLIC SUB Timer1_Timer()
LCDNumber1.Value = LCDNumber1.Value + 1
numberloop = numberloop + 1
Label1.Text = numberloop
END

PUBLIC SUB Button3_Click()
ME.Close
END


PUBLIC SUB bstart_Click()
Timer1.Start()
END

PUBLIC SUB bstop_Click()
Timer1.Stop()
numberloop = 0
END

PUBLIC SUB Button1_Click() ' bouton trigger
Timer1.Trigger()
END


Creation date : 08/11/2010 @ 10:41
Last update : 08/11/2010 @ 10:41
Category : TIMER
Page read 5308 times


Print the article Print the article


react.gifReactions to this article

Nobody gave a comment yet.
Be the first one to do it!


QUICK MENU
SEARCH




LANGUAGE
COMPONENTS
Other
LANGUAGE
Where, who?
VISITS

   visitors

   visitors online

ARCHIVES GAMBAS 1/2
^ Top ^