Gambas France BETA


Pas de compte ? Incription

Partie 2 :

Les Parties :





Seconde partie : l'utilisation :



image de la form dans l'IDE :


Où l'on voit :
- le gridView qui va recevoir les informations contenues dans la base
- le menu des langues (pour en changer)
- le bouton "Base" qui permet d'accéder à la gestion de la base : - pour Ajout - pour Suppression - pour Modification, des enregistrements de celle-ci.
- les boutons de navigation et sélection dans la base
- les toolButtons qui reprennent les commandes du menu Fichier.



image de la form alimentée :





Les Déclarations :


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
' Gambas class file

PUBLIC myRow AS INTEGER

PUBLIC nomForm AS STRING
PUBLIC rMarque AS STRING
PUBLIC rReference AS STRING
PUBLIC Mark AS STRING
PUBLIC Ref AS STRING
PUBLIC Resultat AS Result
PUBLIC RetourSel AS BOOLEAN
PUBLIC triOK AS BOOLEAN
PUBLIC RetourDim AS BOOLEAN

PUBLIC rNumero AS INTEGER
PUBLIC rMMS AS FLOAT
PUBLIC rSD AS FLOAT
PUBLIC rFR AS FLOAT
PUBLIC rQT AS FLOAT
PUBLIC rQM AS FLOAT
PUBLIC rRCC AS FLOAT
PUBLIC rFichTech AS STRING

PUBLIC cBL AS FLOAT
PUBLIC cEFF AS FLOAT
PUBLIC cLAS AS FLOAT
PUBLIC cQTD AS FLOAT
PUBLIC cCHP AS FLOAT
PUBLIC cFA AS FLOAT
PUBLIC cRend AS FLOAT
PUBLIC cQE AS FLOAT
PUBLIC cSAS AS FLOAT
PUBLIC cVAS AS FLOAT
PUBLIC cMAS AS FLOAT
PUBLIC cDS AS FLOAT
PUBLIC cVDVAS AS FLOAT
PUBLIC cQTDSD AS FLOAT
PUBLIC cQMRMS AS FLOAT
PUBLIC cQTQTD AS FLOAT
PUBLIC cBlb AS STRING

PUBLIC triBase AS STRING
PUBLIC triEncours AS STRING
PUBLIC monTri AS STRING
PUBLIC triSQL AS STRING = "SELECT * FROM hautparleur "
PUBLIC triSel AS STRING
PUBLIC triSelOrdre AS STRING
PUBLIC ordre AS STRING = "ORDER BY "

PUBLIC BaseRef AS BOOLEAN
PUBLIC flag AS BOOLEAN
PUBLIC synthe AS BOOLEAN
PUBLIC texteEnc AS STRING
PUBLIC leTri AS STRING
PUBLIC Enreg AS BOOLEAN
PUBLIC RetourQ AS BOOLEAN

PUBLIC indBool AS BOOLEAN

L'ouverture form principale :


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
PUBLIC SUB Form_Open()

FichierConf()

IF NOT db.Current.Opened THEN
db.Current.Open
ENDIF
IF FMain.Enreg THEN
FMain.mnFormEnreg.Enabled = FALSE
FMain.mnFormEnreg.Visible = FALSE
ENDIF
drap = 0
ME.center

creatCol() 'création des colonnes du GridView

FMain.triBase = "SELECT * FROM hautparleur ORDER BY numero ASC" 'initialisation de triBase
GridRemplis()

CompteurInit = Resultat.Count 'initialisation du compteur
IndexInit = Resultat.Index 'initialisation de l'index
FMain.clef = Resultat.Index 'initialisation de l'index clef
textbox2.Text = " " & Str(Compteur) & " sur un total de " & Str(CompteurInit)

myRow = 0
GridView1.Row = 0 'initialise le gridview

GridView1.RowAt(myRow)
GridView1.Select(myRow)
GridView1.Refresh()
Deplacement()

db.Current.Close()

IF Settings["First_Time", TRUE] = TRUE THEN 'démarrage première fois
Settings["First_Time"] = FALSE
Settings["General/LangInit"] = Left(System.Language, 2)
ENDIF

CATCH
Message.Error(Str(Error.Class) & ", code : " & Error.Code & ", " & Str(Error.Backtrace) & " à " Error.Where)

END


PUBLIC SUB Form_Close()

ME.Hide
ModPrinc.FinProg()

CATCH
Message.Error(Str(Error.Class) & ", code : " & Error.Code & ", " & Str(Error.Backtrace) & " à " Error.Where)

Navigation dans le GridView :


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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
PUBLIC SUB tbPREV_Click() 'previous

IF myrow = 0 THEN
FMain.beep()
ELSE
FMain.camera()
ENDIF
myRow = myRow - 1

IF RetourSel = TRUE THEN
drap = 0
Deplacement()
ENDIF

IF myRow < 0 THEN
myRow = 0
ENDIF

drap = 0
GridView1.RowAt(myRow)
GridView1.Select(myRow)
Deplacement()

END

PUBLIC SUB tbNEXT_Click() 'next

IF myRow >= GridView1.Rows.Count - 1 THEN
FMain.beep()
ELSE
FMain.camera()
myRow = myRow + 1
ENDIF
IF RetourSel = TRUE THEN
drap = 0
Deplacement()
ENDIF
drap = 0
GridView1.RowAt(myRow)
GridView1.Select(myRow)
Deplacement()

END

PUBLIC SUB tbFIRST_Click() 'first

IF myRow = 0 THEN
FMain.beep()
ELSE
FMain.camera()
ENDIF

myRow = 0
drap = 0

GridView1.RowAt(myRow)
GridView1.Select(myRow)
Deplacement()

END

PUBLIC SUB tbLAST_Click() 'last

IF myRow = GridView1.Rows.Count - 1 THEN
FMain.beep()
ELSE
FMain.camera()
ENDIF
myRow = GridView1.Rows.Max
IF RetourSel THEN
drap = 0
GridView1.RowAt(myRow)
GridView1.Select(myRow)
Deplacement()
ENDIF

drap = 0
GridView1.RowAt(myRow)
GridView1.Select(myRow)
Deplacement()

END


PUBLIC SUB GridView1_DblClick() 'vers gestion base

mnGESTBASE_Click

END

PUBLIC SUB GridView1_KeyPress()

SELECT CASE Key.Code
CASE Key.Return
GridView1_MouseDown()
CASE Key.Up

CASE Key.Down

CASE Key.PageDown

CASE Key.PageUp

CASE Key.Home

CASE Key.End

CASE ELSE
FMain.beep
END SELECT

END

Tri des Colonnes du GridView :


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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
PUBLIC SUB GridView1_ColumnClick(Column AS INTEGER) 'tri des colonnes du GridView

DIM Values, ValueSorted AS NEW String[]
DIM Nx, iNx AS INTEGER
' Dim ordre As String = "ORDER BY " 'déclarée en Public

IF db.Current.Opened = FALSE THEN
db.Current.Open
ENDIF

IF triOK = TRUE THEN 'retour de sélection
triEncours = triSQL & triSel & ordre
ELSE
triEncours = triSQL & ordre
ENDIF

SELECT CASE Column

CASE 0
IF monTri = "numero" THEN
triEnCours = triEnCours & monTri & " DESC"
monTri = ""
FMain.leTri = "Numéro DESC"
ELSE
monTri = "numero"
triEnCours = triEnCours & monTri & " ASC"
FMain.leTri = "Numéro ASC"
END IF
GridView1.Tooltip = ""

CASE 1
IF monTri = "marque" THEN
triEnCours = triEnCours & monTri & " DESC"
monTri = ""
FMain.leTri = "Marque DESC"
ELSE
monTri = "marque"
triEnCours = triEnCours & monTri & " ASC"
FMain.leTri = "Marque ASC"
END IF
GridView1.Tooltip = ""

CASE 2
IF monTri = "reference" THEN
triEnCours = triEnCours & monTri & " DESC"
monTri = ""
FMain.leTri = "Référence DESC"
ELSE
monTri = "reference"
triEnCours = triEnCours & monTri & " ASC"
FMain.leTri = "Référence ASC"
END IF
GridView1.Tooltip = ""

CASE 3
IF monTri = "mms*1" THEN
triEnCours = triEnCours & monTri & " DESC"
monTri = ""
FMain.leTri = "MMS DESC"
ELSE
monTri = "mms*1"
triEnCours = triEnCours & monTri & " ASC"
FMain.leTri = "MMS ASC"
END IF
GridView1.Tooltip = ""

CASE 4
IF monTri = "sd*1" THEN
triEnCours = triEnCours & monTri & " DESC"
monTri = ""
FMain.leTri = "SD DESC"
ELSE
monTri = "sd*1"
triEnCours = triEnCours & monTri & " ASC"
FMain.leTri = "SD ASC"
END IF
GridView1.Tooltip = ""

CASE 5
IF monTri = "fr*1" THEN
triEnCours = triEnCours & monTri & " DESC"
monTri = ""
FMain.leTri = "FR DESC"
ELSE
monTri = "fr*1"
triEnCours = triEnCours & monTri & " ASC"
FMain.leTri = "FR ASC"
END IF
GridView1.Tooltip = ""

CASE 6
IF monTri = "qt*1" THEN
triEnCours = triEnCours & monTri & " DESC"
monTri = ""
FMain.leTri = "QT DESC"
ELSE
monTri = "qt*1"
triEnCours = triEnCours & monTri & " ASC"
FMain.leTri = "QT ASC"
END IF
GridView1.Tooltip = ""

CASE 7
IF monTri = "qm*1" THEN
triEnCours = triEnCours & monTri & " DESC"
monTri = ""
FMain.leTri = "QM DESC"
ELSE
monTri = "qm*1"
triEnCours = triEnCours & monTri & " ASC"
FMain.leTri = "QM ASC"
END IF
GridView1.Tooltip = ""

CASE 8
IF monTri = "rcc*1" THEN
triEnCours = triEnCours & monTri & " DESC"
monTri = ""
FMain.leTri = "RCC DESC"
ELSE
monTri = "rcc*1"
triEnCours = triEnCours & monTri & " ASC"
FMain.leTri = "RCC ASC"
END IF
GridView1.Tooltip = ""

CASE 9
IF monTri = "a" THEN
triEnCours = triEnCours & monTri & " DESC"
monTri = ""
FMain.leTri = "A DESC"
ELSE
monTri = "a"
triEnCours = triEnCours & monTri & " ASC"
FMain.leTri = "A ASC"
END IF
GridView1.Tooltip = ""

CASE 10
IF monTri = "b" THEN
triEnCours = triEnCours & monTri & " DESC"
monTri = ""
FMain.leTri = "B DESC"
ELSE
monTri = "b"
triEnCours = triEnCours & monTri & " ASC"
FMain.leTri = "B ASC"
END IF
GridView1.Tooltip = ""

CASE 11
IF monTri = "c" THEN
triEnCours = triEnCours & monTri & " DESC"
monTri = ""
FMain.leTri = "C DESC"
ELSE
monTri = "c"
triEnCours = triEnCours & monTri & " ASC"
FMain.leTri = "C ASC"
END IF
GridView1.Tooltip = ""

CASE 12
IF monTri = "d" THEN
triEnCours = triEnCours & monTri & " DESC"
monTri = ""
FMain.leTri = "D DESC"
ELSE
monTri = "d"
triEnCours = triEnCours & monTri & " ASC"
FMain.leTri = "D ASC"
END IF
GridView1.Tooltip = ""

'champs calculés
CASE 13 'qtd
IF monTri = "2 * 3.1416 * fr *mms/ (1.18 * 344 * sd)" THEN
triEnCours = triEnCours & monTri & " DESC"
monTri = ""
FMain.leTri = "QTD DESC"
ELSE
monTri = "2 * 3.1416 * fr *mms/ (1.18 * 344 * sd)"
triEnCours = triEnCours & monTri & " ASC"
FMain.leTri = "QTD ASC"
END IF

CASE 14 'chp
IF monTri = "fr / (qm / ((qm / qt) - 1))" THEN
triEnCours = triEnCours & monTri & " DESC"
monTri = ""
FMain.leTri = "CHP DESC"
ELSE
monTri = "fr / (qm / ((qm / qt) - 1))"
triEnCours = triEnCours & monTri & " ASC"
FMain.leTri = "CHP ASC"
END IF

CASE 18 ' qe
IF monTri = "qm / ((qm / qt) - 1)" THEN
triEnCours = triEnCours & monTri & " DESC"
monTri = ""
FMain.leTri = "QE DESC"
ELSE
monTri = "qm / ((qm / qt) - 1)"
triEnCours = triEnCours & monTri & " ASC"
FMain.leTri = "QE ASC"
END IF
'
CASE 19 ' sas
IF monTri = "1.18 * 344 / (2 * 3.1416 * fr * (mms / (sd *sd)))" THEN
triEnCours = triEnCours & monTri & " DESC"
monTri = ""
FMain.leTri = "SAS DESC"
ELSE
monTri = "1.18 * 344 / (2 * 3.1416 * fr * (mms / (sd *sd)))"
triEnCours = triEnCours & monTri & " ASC"
FMain.leTri = "SAS ASC"
END IF
'
CASE 20 ' las
IF monTri = "344 / (2 * 3.1416 * fr)" THEN
triEnCours = triEnCours & monTri & " DESC"
monTri = ""
FMain.leTri = "LAS DESC"
ELSE
monTri = "344 / (2 * 3.1416 * fr)"
triEnCours = triEnCours & monTri & " ASC"
FMain.leTri = "LAS ASC"
END IF
'
CASE 21 ' vas
IF monTri = "1.18 * 344 *344 / ((2 * 3.1416 * fr)* (2 * 3.1416 * fr)* (mms/ (sd*sd)))" THEN
triEnCours = triEnCours & monTri & " DESC"
monTri = ""
FMain.leTri = "VAS DESC"
ELSE
monTri = "1.18 * 344 *344 / ((2 * 3.1416 * fr)* (2 * 3.1416 * fr)* (mms/ (sd*sd)))"
triEnCours = triEnCours & monTri & " ASC"
FMain.leTri = "VAS ASC"
END IF
'
CASE 22 ' mas
IF monTri = "mms / (sd*sd)" THEN
triEnCours = triEnCours & monTri & " DESC"
monTri = ""
FMain.leTri = "MAS DESC"
ELSE
monTri = "mms / (sd*sd)"
triEnCours = triEnCours & monTri & " ASC"
FMain.leTri = "MAS ASC"
END IF
'
CASE 23 ' BL
IF monTri = "(2 * 3.1416 * rcc * fr * mms / (qm / ((qm / qt) - 1)))" THEN
triEnCours = triEnCours & monTri & " DESC"
monTri = ""
FMain.leTri = "BL DESC"
ELSE
monTri = "(2 * 3.1416 * rcc * fr * mms / (qm / ((qm / qt) - 1)))"
triEnCours = triEnCours & monTri & " ASC"
FMain.leTri = "BL ASC"
END IF
'
CASE 24 ' DS
IF monTri = "(4 * sd / 3.1416)" THEN
triEnCours = triEnCours & monTri & " DESC"
monTri = ""
FMain.leTri = "DS DESC"
ELSE
monTri = "(4 * sd / 3.1416)"
triEnCours = triEnCours & monTri & " ASC"
FMain.leTri = "DS ASC"
END IF
' champs ajoutés
CASE 25
IF monTri = "((mms/1.18)/(1.18 * 344 *344 / ((2 * 3.1416 * fr)* (2 * 3.1416 * fr)* (mms/ (sd*sd)))))" THEN
triEnCours = triEnCours & monTri & " DESC"
monTri = ""
FMain.leTri = "VD/VAS DESC"
ELSE
monTri = "((mms/1.18)/(1.18 * 344 *344 / ((2 * 3.1416 * fr)* (2 * 3.1416 * fr)* (mms/ (sd*sd)))))"
triEnCours = triEnCours & monTri & " ASC"
FMain.leTri = "VD/VAS ASC"
END IF
CASE 26
IF monTri = "(2*3.1416*fr*mms*sd/(1.18*344*sd))" THEN
triEnCours = triEnCours & monTri & " DESC"
monTri = ""
FMain.leTri = "QTD*SD DESC"
ELSE
monTri = "(2*3.1416*fr*mms*sd/(1.18*344*sd))"
triEnCours = triEnCours & monTri & " ASC"
FMain.leTri = "QTD*SD ASC"
END IF
CASE 27
IF monTri = "(2*3.1416*mms)" THEN
triEnCours = triEnCours & monTri & " DESC"
monTri = ""
FMain.leTri = "Qm*Rms DESC"
ELSE
monTri = "(2*3.1416*mms)"
triEnCours = triEnCours & monTri & " ASC"
FMain.leTri = "Qm*Rms ASC"
END IF
CASE 28
IF monTri = "(qt/(2*3.1416*fr*mms/(1.18*344*sd)))" THEN
triEnCours = triEnCours & monTri & " DESC"
monTri = ""
FMain.leTri = "QT/QTD DESC"
ELSE
monTri = "(qt/(2*3.1416*fr*mms/(1.18*344*sd)))"
triEnCours = triEnCours & monTri & " ASC"
FMain.leTri = "QT/QTD ASC"
END IF

CASE 29
IF monTri = "FichTech" THEN
triEnCours = triEnCours & monTri & " DESC"
monTri = ""
FMain.leTri = "FichTech DESC"
ELSE
monTri = "FichTech"
triEnCours = triEnCours & monTri & " ASC"
FMain.leTri = "FichTech ASC"
END IF
GridView1.Tooltip = ""
' fin champ ajoutés

CASE ELSE 'GridView1_ColumnClick(Column As Integer)

GridView1.Tooltip = ("Cliquer au moins deux fois\n" & "sur les entêtes des champs calculés\n" "pour bien les ordonner.")
FMain.Mouse = Mouse.Wait
FMain.beep

FOR Nx = 0 TO GridView1.Rows.Max
Values.Add((GridView1[Nx, GridView1.Columns.Sort].Text))
NEXT

ValueSorted = Values.Copy()
ValueSorted.Sort((IIf(GridView1.Columns.Ascending, gb.Ascent, gb.Descent)))

FOR Nx = 0 TO ValueSorted.Max

FOR iNx = 0 TO GridView1.Columns.Max
SWAP (GridView1[Nx, iNx].Text), (GridView1[Values.Find((ValueSorted[Nx]), 0, Nx), iNx].Text)
NEXT

Values.Clear()

FOR iNx = 0 TO GridView1.Rows.Max
Values.Add((GridView1[iNx, GridView1.Columns.Sort].Text))
NEXT

NEXT

GridView1.Refresh()
GOTO sortie

END SELECT

FMain.triBase = triEncours

IF triOK = TRUE THEN
triSelOrdre = Mid(triencours, RInStr(triEncours, triSel & ordre & monTri))
ELSE
triSelOrdre = Mid(triencours, RInStr(triEncours, ordre & monTri))
ENDIF


Resultat = DB.Current.Exec(FMain.tribase)
FMain.clef = FMain.Resultat.Index

GridRemplis()

sortie:
db.Current.Close()
FMain.Mouse = Mouse.Default
shade()

END

Création des colonnes du GridView


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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
PUBLIC SUB creatCol() 'création des colonnes du GridView

DIM i AS INTEGER

WITH GridView1

.AddColumn("numero", 70, 3)
.AddColumn("marque", 160, 3)
.AddColumn("reference", 160, 3)
.AddColumn("mms", 90, 3)
.AddColumn("sd", 70, 3)
.AddColumn("fr", 70, 3)
.AddColumn("qt", 70, 3)
.AddColumn("qm", 70, 3)
.AddColumn("rcc", 70, 3)
'champs dimensions
.AddColumn("cA", 70, 3)
.AddColumn("cB", 70, 3)
.AddColumn("cC", 70, 3)
.AddColumn("cD", 70, 3)
' champs calculés
.AddColumn("cQTD", 70, 3)
.AddColumn("cCHP", 70, 3)
.AddColumn("cFA", 70, 3)
.AddColumn("cEFF", 70, 3)
.AddColumn("cRend", 70, 3)
.AddColumn("cQE", 70, 3)
.AddColumn("cSAS", 70, 3)
.AddColumn("cLAS", 70, 3)
.AddColumn("cVAS", 70, 3)
.AddColumn("cMAS", 70, 3)
.AddColumn("cBL", 70, 3)
.AddColumn("cDS", 70, 3)
' ajout colonne 25
.AddColumn("cVDVAS", 70, 3)
.AddColumn("cQTDSD", 70, 3)
.AddColumn("cQMRMS", 70, 3)
.AddColumn("cQTQTD", 70, 3)

.AddColumn("cBlb", 70, 3)

.Columns[0].width = 70
.Columns[1].width = 160
.Columns[2].width = 160
.Columns[3].width = 90
.Columns[4].width = 90
.Columns[5].width = 70
.Columns[6].width = 80
.Columns[7].width = 80
.Columns[8].width = 70

.Columns[9].width = 50
.Columns[10].width = 50
.Columns[11].width = 50
.Columns[12].width = 50

.Columns[13].width = 70
.Columns[14].width = 70
.Columns[15].width = 70
.Columns[16].width = 70
.Columns[17].width = 70
.Columns[18].width = 70
.Columns[19].width = 70
.Columns[20].width = 70
.Columns[21].width = 70
.Columns[22].width = 70
.Columns[23].width = 70
.Columns[24].width = 70
' ajout colonne 25
.Columns[25].width = 70
.Columns[26].width = 70
.Columns[27].width = 70
.Columns[28].width = 70

.Columns[29].width = 80

FOR i = 0 TO 29
.Columns[i].Alignment = Align.Center
NEXT

FOR i = 0 TO 12
.Columns[i].Background = Color.Default
NEXT

FOR i = 13 TO 28
.Columns[i].Background = Color.ButtonBackground
NEXT

.Columns[0].Title = "N° Fiche"
.Columns[1].Title = "Marques"
.Columns[2].Title = "Références"
.Columns[3].Title = "MMS"
.Columns[4].Title = "SD"
.Columns[5].Title = "FR"
.Columns[6].Title = "QT"
.Columns[7].Title = "QM"
.Columns[8].Title = "Rcc"

.Columns[9].Title = "dim. A"
.Columns[10].Title = "dim. B"
.Columns[11].Title = "dim. C"
.Columns[12].Title = "dim. D"

.Columns[13].Title = "QTD"
.Columns[14].Title = "CHP"
.Columns[15].Title = "FA"
.Columns[16].Title = "EFF"
.Columns[17].Title = "Rend%"
.Columns[18].Title = "QE"
.Columns[19].Title = "SAS"
.Columns[20].Title = "LAS"
.Columns[21].Title = "VAS"
.Columns[22].Title = "MAS"
.Columns[23].Title = "BL"
.Columns[24].Title = "DS"
' ajout colonne 25
.Columns[25].Title = "VD/VAS"
.Columns[26].Title = "QTD*SD=K"
.Columns[27].Title = "QM*RMS"
.Columns[28].Title = "QT/QTD"
.Columns[29].Title = "Fiche T."

.Sorted = TRUE

END WITH

END SUB

PUBLIC SUB tee() 'mise à jour du compteur et de l'index

IF NOT db.Current.Opened THEN
db.Current.Open
ENDIF

Resultat = DB.Current.Exec(FMain.tribase)

IF Resultat.Available = TRUE THEN
FMain.clef = Resultat.Index
ENDIF

db.Current.Begin
db.Current.Commit

END

PUBLIC SUB GridView1_MouseUp() 'mise à jour du GridView suite à une sélection

Deplacement()

END

PUBLIC SUB GridView1_MouseDown() 'sélection d'une ligne ou Row du GridView

DIM Row AS INTEGER

FMain.shade()
Row = GridView1.Row
WITH GridView1
.Mode = Select.Single
.Select(Row)
END WITH
myRow = Row

END

PUBLIC SUB Deplacement() 'Déplacement dans la base de données

DIM Row AS INTEGER

IF NOT db.Current.Opened THEN
db.Current.Open
ENDIF

Resultat = DB.Current.Exec(FMain.triBase)

'en fonction des boolean
IF FMain.RetourQ = TRUE AND RetourSel = TRUE THEN
Row = Resultat.Index
ELSE IF FMain.RetourQ = TRUE THEN
Row = FMain.clef
ELSE IF RetourSel = TRUE THEN
RetourSel = FALSE
ELSE
Row = GridView1.Row
ENDIF


Resultat.MoveTo(Row)
WITH GridView1
.Mode = Select.Single
.Select(Row)
END WITH

FMain.clef = Resultat.Index 'mise à jour de fmain.clef
myRow = Row

TextLabel7.Text = ("Fiche N° " & Resultat!numero & " | " & Resultat!marque & " | " & Resultat!reference

CATCH
Message.Error(Str(Error.Class) & ", code : " & Error.Code & ", " & Str(Error.Backtrace) & " à " Error.Wher "\n Error.Tex " à Deplacement

END

PUBLIC SUB RetourQuery() ' application de la sélection

DIM monRow AS INTEGER

IF NOT db.Current.Opened THEN
db.Current.Open
ENDIF

Resultat = DB.Current.Exec(FMain.triBase)

IF Resultat.Available = FALSE THEN
beep
Message.Info("Fiches inexistantes\nou saisie erronée"
indBool = TRUE
ELSE
indBool = FALSE
GridView1.Rows.Count = Resultat.Count ' limite le nombre de ligne à ce qu'il y a dans la requête
Compteur = Resultat.Count
textbox2.Text = " " & Str(Compteur) & " sur un total de " & Str(CompteurInit)

FOR EACH Resultat
monRow = Resultat.Index
WITH GridView1
.[monRow, 0].Text = Resultat!numero
.[monRow, 1].Text = Resultat!marque
.[monRow, 2].Text = Resultat!reference
.[monRow, 3].Text = Resultat!mms
.[monRow, 4].Text = Resultat!sd
.[monRow, 5].Text = Resultat!fr
.[monRow, 6].Text = Resultat!qt
.[monRow, 7].Text = Resultat!qm
.[monRow, 8].Text = Resultat!rcc
.[monRow, 9].Text = Resultat!a
.[monRow, 10].Text = Resultat!b
.[monRow, 11].Text = Resultat!c
.[monRow, 12].Text = Resultat!d
.[monRow, 29].Text = Resultat!FichTech
END WITH

NEXT

drap = 1

IF retoursel = TRUE THEN
IF Resultat.count > FMain.clef THEN
Resultat.MoveTo(0)
FMain.clef = 0
ELSE
Resultat.MoveTo(FMain.clef)
ENDIF
triOK = TRUE
ENDIF

Deplacement
'pour mise à jour de l'affichage
IF RetourQ = FALSE THEN
GridRemplis()
ELSE
RetourQ = FALSE
ENDIF
'
db.Current.Close

ENDIF

CATCH
Message.Error(Str(Error.Class) & ", code : " & Error.Code & ", " & Str(Error.Backtrace) & " à " Error.Wher "\n Error.Tex " à RetourQuery

END

Remplissage du GridView


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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
PUBLIC SUB GridRemplis() 'remplissage du GridView

DIM Row AS INTEGER

IF NOT db.Current.Opened THEN
db.Current.Open
ENDIF

Resultat = DB.Current.Exec(FMain.triBase)
' Bouton 'controle enabled de GestBase
IF Resultat.Available THEN
FOR EACH Resultat
rMMS = Resultat!mms
rSD = Resultat!sd
rFR = Resultat!fr
rQT = Resultat!qt
rQM = Resultat!qm
rRCC = Resultat!rcc
rFichTech = Resultat!FichTech
'champs calculés
cQTD = 2 * Pi * rFR * rMMS / (po * 344 * rSD)
cQE = rQM / ((rQM / rQT) - 1)
cCHP = rFR / cQE
cBL = Sqr(2 * Pi * rRCC * rFR * rMMS / cQE)
cFA = cBL / rMMS
cLAS = 344 / (2 * Pi * rFR)
cMAS = rMMS / rSD ^ 2
cVAS = po * 344 ^ 2 / ((2 * Pi * rFR) ^ 2 * cMAS)
cSAS = po * 344 / (2 * Pi * rFR * cMAS)
cRend = rFR ^ 3 * cVAS * 0.00000096 / cQE * 100
cEFF = 10 * Log10(cRend / 0.065) + 80
cDS = Sqr(4 * rSD / Pi)
' ajout colonne 25
cVDVAS = rMMS / po / cVAS
cQTDSD = cQTD * rSD
cQMRMS = 2 * Pi * rFR * rMMS
cQTQTD = rQT / cQTD

Row = Resultat.index 'incrément de Row
WITH GridView1
.Rows.Count = Resultat.Count
'champs de la base
.[Row, 0].Text = Resultat!numero
.[Row, 1].Text = Resultat!marque
.[Row, 2].Text = Resultat!reference
.[Row, 3].Text = Resultat!mms
.[Row, 4].Text = Resultat!sd
.[Row, 5].Text = Resultat!fr
.[Row, 6].Text = Resultat!qt
.[Row, 7].Text = Resultat!qm
.[Row, 8].Text = Resultat!rcc
'champs dimensions
.[Row, 9].Text = Resultat!a
.[Row, 10].Text = Resultat!b
.[Row, 11].Text = Resultat!c
.[Row, 12].Text = Resultat!d
'champs calculés
.[Row, 13].Text = CStr(Format(cQTD, frmt1))
.[Row, 14].Text = CStr(Format(cCHP, frmt1))
.[Row, 15].Text = CStr(Format(cFA, frmt1))
.[Row, 16].Text = CStr(Format(cEFF, frmt1))
.[Row, 17].Text = CStr(Format(cRend, frmt1))
.[Row, 18].Text = CStr(Format(cQE, frmt1))
.[Row, 19].Text = CStr(Format(cSAS, frmt1))
.[Row, 20].Text = CStr(Format(cLAS, frmt1))
.[Row, 21].Text = CStr(Format(cVAS, frmt1))
.[Row, 22].Text = CStr(Format(cMAS, frmt1))
.[Row, 23].Text = CStr(Format(cBL, frmt1))
.[Row, 24].Text = CStr(Format(cDS, frmt1))
' ajout colonne 25
.[Row, 25].Text = CStr(Format(cVDVAS, frmt2))
.[Row, 26].Text = CStr(Format(cQTDSD, frmt2))
.[Row, 27].Text = CStr(Format(cQMRMS, frmt1))
.[Row, 28].Text = CStr(Format(cQTQTD, frmt1))
' blob
.[Row, 29].Text = Resultat!FichTech
END WITH
NEXT
Resultat.MoveNext
ENDIF

myRow = Resultat.Index
Compteur = Resultat.Count
textbox2.Text = " " & Str(Compteur) & " sur un total de " & Str(CompteurInit)


GridView1.Refresh()
WAIT

CATCH
Message.info("relancer le programme : " & Error.text)

END SUB


PUBLIC SUB ToolButton6_Click() 'réinitialisation base

FMain.beep()
IF NOT db.Current.Opened THEN
db.Current.Open()
ENDIF

FMain.triBase = "SELECT * FROM hautparleur ORDER BY numero ASC"
GridRemplis()
BaseRef = FALSE
triOK = FALSE 'mise à jour du tri normal
triSelOrdre = ""
db.Current.Close()

GridView1.RowAt(0)
GridView1.Select(0)
Deplacement()

END


====================

Commandes utilisées :


DatabaseSqlite
DB
Result
Message
Select case
Return
GridView

====================


Navigation :



<-- Liens du Wiki : <--
<-- Accueil du WIKI : <--

====================

Documentation :



====================