Gambas France BETA


Pas de compte ? Incription

Plusieurs

À propos de ce code

Démonstration de l'utilisation de :
Spinner
SpinBar
Slider
SliderBox
SpinBox
ValueBox

Code source

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
' Gambas class file

PUBLIC hConsoleTimer AS Timer
PUBLIC siCount AS SHORT
PUBLIC iTemp AS INTEGER

PUBLIC SUB Form_Open()

hConsoleTimer = NEW Timer AS "Timer1" 'création du timer
DefTimer()

END

PUBLIC SUB DefTimer()

hConsoleTimer.Delay = 1 'delay pour la boucle évènement (1 milliseconde)
iTemp = 5000
siCount = 0

END

PUBLIC SUB Timer1_Timer()

Spinner1.Visible = TRUE
INC siCount

Spinner1.value = siCount / iTemp
SpinBar1.Value = siCount / iTemp
ScrollBar1.Value = siCount / iTemp * 100
ScrollBar2.Value = siCount / iTemp * 100
Slider1.Value = siCount / iTemp * 100
SliderBox1.Value = siCount / iTemp * 100
SpinBox1.Value = siCount / iTemp * 100
Separator1.H = 0
Separator1.H = (siCount / iTemp * 308)
ValueBox1.Value = siCount

IF siCount = iTemp THEN
Spinner1.Stop
hConsoleTimer.Stop
btnDemarrer.Text = "Démarrer"
ENDIF

END

PUBLIC SUB btnDemarrer_Click()

IF btnDemarrer.Text = "Arrêter" THEN
Spinner1.Stop
hConsoleTimer.Enabled = FALSE
btnDemarrer.Text = "Démarrer"
ELSE
DefTimer()
Spinner1.Start
hConsoleTimer.Enabled = TRUE
btnDemarrer.Text = "Arrêter"
ENDIF

END

PUBLIC SUB btnQuitter_Click()

ME.Close()

END

PUBLIC SUB Form_Close()

hConsoleTimer.Stop 'on arrête le timer
Spinner1.Stop
hConsoleTimer = NULL 'on nettoie
Spinner1 = NULL

END

Commentaires