Gambas France BETA


Pas de compte ? Incription

ButtonBox :

Exemple d'utilisation de ButtonBox :





Exemple téléchargeable ici : ButtonBox

Le Code :



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

PUBLIC SUB Form_Open()

FMain.Center
FMain.Resizable = TRUE
ButtonBoxProject.Picture = Picture["icon:/16/open"]
ButtonBoxProject.ReadOnly = TRUE
btnList.Enabled = FALSE
btnMakeArchive.Enabled = FALSE

END ' Form_Open()

PUBLIC SUB ButtonBoxProject_Click()

IF Dialog.SelectDirectory() THEN RETURN
ButtonBoxProject.Text = Dialog.Path
btnList.Enabled = TRUE

END ' ButtonBoxProject_Click()

PUBLIC SUB btnList_Click()

DIM aProject AS String[]
DIM sLine AS STRING

TRY aProject = Split(File.Load(ButtonBoxProject.Text &/ ".project"), "\n")
IF ERROR THEN
Message.Error(("Das Verzeichnis enthält kein Gambas3-Projekt!")
WAIT 0.5
ButtonBoxProject.Clear
btnList.Enabled = FALSE
RETURN
ENDIF ' ERROR ?
FOR EACH sLine IN aProject
IF sLine NOT BEGINS "Component=" THEN CONTINUE
sLine = Mid$(sLine, Len("Component=") + 1)
trvFiles.Add(sLine, ("Komponente: ") & sLine)
AddAllFiles(sLine)
NEXT ' sLine
btnMakeArchive.Enabled = TRUE

END ' btnList_Click()

PUBLIC SUB btnClose_Click()

FMain.Close()

END ' btnClose_Click()


PRIVATE SUB AddAllFiles(sComp AS STRING)

DIM sFile AS STRING

FOR EACH sFile IN Dir("/usr/lib/gambas3/", sComp & ".{so,gambas,la,component,info}*")
trvFiles.Add(sFile, sFile,, sComp)
NEXT ' sFile

END ' AddAllFiles(sComp As String)

PUBLIC SUB btnMakeArchive_Click()

DIM sList AS STRING

IF NOT trvFiles.MoveFirst() THEN
DO
IF trvFiles.MoveChild() THEN CONTINUE
DO
sList &= trvFiles.Item.Key & " "
LOOP UNTIL trvFiles.MoveNext()
trvFiles.MoveBack()
trvFiles.MoveParent()
LOOP UNTIL trvFiles.MoveNext()
ENDIF ' Not trvFiles.MoveFirst() ?

Dialog.Filter = [".tar.gz", ("Tar/GZip files")]
IF Dialog.SaveFile() THEN RETURN
IF Dialog.Path NOT ENDS ".tar.gz" THEN Dialog.Path &= ".tar.gz"
sList = Trim$(sList)
SHELL Subst$("cd /usr/lib/gambas3; tar -zcf &1 &2", Dialog.Path, sList)
IF Process.LastValue THEN
Message.Error(("Das ging in die Hose ..."))
ELSE
Message.Info(("Das Archiv wurde erfolgreich angelegt."))
btnList.Enabled = FALSE
btnMakeArchive.Enabled = FALSE
ButtonBoxProject.Clear
trvFiles.Clear
ENDIF ' Process.LastValue ?

END ' btnMakeArchive_Click()


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

Navigation :



<-- Liens du Wiki : <--
<-- Accueil du WIKI : <--
<-- Contrôle par Contrôle <--

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

Documentation :



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