Gambas France BETA


Pas de compte ? Incription

Misc

Console


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

PRIVATE $hProcess AS Process
PRIVATE $sText AS STRING

STATIC PUBLIC SUB Main()

DIM hForm AS Form

hForm = NEW FConsole
hForm.Show

END

PUBLIC SUB _new()

$hProcess = EXEC ["bash", "--noediting"] FOR INPUT OUTPUT AS "Process"

END

PUBLIC SUB Form_Close()

$hProcess.Kill

END

PUBLIC SUB Process_Read()

DIM sStr AS STRING

'Debug Eof(Last);; Lof(Last);;
'While Not sStr
READ #$hProcess, sStr, -256
'Wend
'Error sStr
$sText = $sText & sStr
'Debug Quote(sStr)
UpdateConsole

END

PUBLIC SUB Process_Error(sStr AS STRING)

$sText = $sText & sStr
UpdateConsole

END

PRIVATE SUB UpdateConsole()

DIM iPos AS INTEGER
DIM sStr AS STRING

WHILE Len($sText)

iPos = InStr($sText, "\n")
IF iPos = 0 THEN iPos = Len($sText)

sStr = Normalize(Left$($sText, iPos))
'Debug sStr
$sText = Mid$($sText, iPos + 1)

txtConsole.Pos = txtConsole.Length
txtConsole.Insert(sStr)

WEND

END

PUBLIC SUB Process_Kill()

'hProcess = NULL
TRY ME.Close

END

PUBLIC SUB txtCommand_Activate()

DIM sLig AS STRING

sLig = txtCommand.Text & gb.NewLine

'txtConsole.Pos = txtConsole.Length
'txtConsole.Insert("# " & sLig)
txtCommand.Clear

sLig = Conv$(sLig, Desktop.Charset, System.Charset)

PRINT #$hProcess, sLig;

END

STATIC PRIVATE FUNCTION Normalize(sStr AS STRING) AS STRING

DIM sNorm AS STRING
DIM iInd AS INTEGER
DIM iCar AS INTEGER
DIM bEsc AS BOOLEAN

' For iInd = 1 To Len(sStr)
'
' iCar = Asc(sStr, iInd)
'
' If iCar = 27 Then
' bEsc = True
' Continue
' Endif
'
' If bEsc Then
' If iCar < 32 Then bEsc = False
' Continue
' Endif
'
' If iCar < 32 And iCar <> 10 Then iCar = 32
'
' sNorm = sNorm & Chr$(iCar)
'
' Next

sNorm = sStr

IF System.Charset = Desktop.Charset THEN
RETURN sNorm
ELSE
RETURN Conv$(sNorm, System.Charset, Desktop.Charset)
ENDIF

END

PUBLIC SUB Form_Open()

txtCommand.SetFocus

END

PUBLIC SUB btnCtrlC_Click()

PRINT #$hProcess, Chr$(3);

END

PUBLIC SUB btnCtrlD_Click()

PRINT #$hProcess, Chr$(4);

END

PUBLIC SUB btnCtrlZ_Click()

PRINT #$hProcess, Chr$(26);

END

DBusExplorer



Evaluator



Explorer



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

PRIVATE $sPath AS STRING
PRIVATE $bHidden AS BOOLEAN
PRIVATE $bCtrl AS BOOLEAN

STATIC PUBLIC SUB Main()

DIM hForm AS Form

hForm = NEW FExplorer(System.User.Home)
Application.MainWindow = hForm
hForm.Show

END

PUBLIC SUB _new(sPath AS STRING)

$sPath = sPath
RefreshExplorer

END

PRIVATE SUB RefreshExplorer()

DIM sFile AS STRING
DIM hPictDir AS Picture
DIM hPictFile AS Picture
DIM cDir AS NEW String[]
DIM sName AS STRING

INC Application.Busy

ME.Title = Conv($sPath, System.Charset, Desktop.Charset)

ivwExplorer.Clear
'ivwExplorer.Arrangement = IconView.Row

hPictDir = Picture["icon:/48/directory"]
hPictFile = Picture["icon:/48/file"]

IF $sPath <> "/" THEN ivwExplorer.Add("D..", "..", hPictDir)

FOR EACH sFile IN Dir($sPath)

IF NOT $bHidden THEN
IF Stat($sPath &/ sFile).Hidden THEN
CONTINUE
ENDIF
ENDIF

IF IsDir($sPath &/ sFile) THEN
cDir.Add("D" & sFile)
ELSE
cDir.Add("F" & sFile)
ENDIF

NEXT

cDir.Sort

FOR EACH sFile IN cDir

sName = Mid$(sFile, 2)

IF Left$(sFile) = "D" THEN
ivwExplorer.Add(sFile, sName, hPictDir)
ELSE
ivwExplorer.Add(sFile, sName, hPictFile)
ENDIF

'ivwExplorer.Item.Editable = TRUE

NEXT

'ivwExplorer.Sorted = FALSE
'ivwExplorer.Ascending = TRUE
'ivwExplorer.Sorted = TRUE

FINALLY

DEC Application.busy

CATCH

Message.Error(Error.Text)

END

PUBLIC SUB mnuQuit_Click()

ME.Close

END

PUBLIC SUB mnuViewRefresh_Click()

RefreshExplorer

END

PUBLIC SUB ivwExplorer_Activate()

DIM sNewPath AS STRING
DIM hForm AS Form

DEBUG LAST.Current.Key

IF LAST.Current.Key = "D.." THEN
IF $sPath = "/" THEN RETURN
sNewPath = File.Dir($sPath)
ELSE
sNewPath = $sPath &/ Mid$(LAST.Current.Key, 2)
ENDIF

IF IsDir(sNewPath) THEN

IF $bCtrl THEN
$bCtrl = FALSE
hForm = NEW FExplorer(sNewPath)
hForm.Move(ME.X + 16, ME.Y + 16, ME.W, ME.H)
hForm.Show
ELSE
$sPath = sNewPath
RefreshExplorer
ENDIF

ENDIF

END

PRIVATE SUB ToggleViewHidden()

$bHidden = NOT mnuViewHidden.Checked

mnuViewHidden.Checked = $bHidden

RefreshExplorer

END

PUBLIC SUB mnuViewHidden_Click()

ToggleViewHidden

END

PUBLIC SUB mnuAbout_Click()

Message(("IconView example written by\nBenoît Minisini")

END

PUBLIC SUB ivwExplorer_Rename()

Message("'" & Mid$(LAST.Item.Key, 2) & ("' has been renamed to '") & LAST.Item.Text & "'")

END

PUBLIC SUB ivwExplorer_KeyPress()

IF Key.Control THEN $bCtrl = TRUE

END

PUBLIC SUB ivwExplorer_KeyRelease()

IF Key.Control THEN $bCtrl = FALSE

END

Notepad



PDFViewer



SystemTray


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

'Private $hImage As Image

PUBLIC SUB _new()

'Me.Background = &H007FFF 'Color.SetAlpha(&H007FFF, 192)

END

PUBLIC SUB Form_Open()

X11Systray.Show(dwgSystemTray.Handle, dwgSystemTray.Background)

END

STATIC PUBLIC SUB X11Systray_Arrange()

DIM I AS INTEGER
DIM X, Y, H AS INTEGER

DEBUG X11Systray.Count
X = 2
Y = 2
FOR I = 0 TO X11Systray.Count - 1
WITH X11Systray[I]
DEBUG I;; .IconW;; .IconH
IF (X + .IconW) >= (ME.ClientW - 2) THEN
X = 2
Y += H + 2
H = 0
ENDIF
.Move(X, Y, .IconW, .IconH)
H = Max(H, .IconH)
X += .IconW + 2
END WITH
NEXT

END

PUBLIC SUB dwgSystemTray_Arrange()

X11Systray.Move(0, 0, dwgSystemTray.Width, dwgSystemTray.Height)

END

WatchGambasDirectory



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

Navigation :



<-- Accueil du WIKI : <--

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

Documentation :



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