Gambas France BETA


Pas de compte ? Incription

Networking

ClientSocket



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

PRIVATE currentDoc AS CpdfPresentation
'PUBLIC Screen AS NEW Window(TRUE) AS "Screen"
PRIVATE currentLogo AS Clogo

PUBLIC SUB glaPresentation_Draw()

IF NOT currentDoc THEN RETURN

IF NOT MMain.ShowLogo THEN
currentDoc.Draw()
ELSE
currentLogo.Draw()
IF currentLogo.Finished = TRUE THEN MMain.ShowLogo = FALSE
ENDIF

END

PUBLIC SUB glaPresentation_KeyPress()

IF Key.code = Key.Escape THEN ME.Close()

IF Key.Code = key["f"] THEN
ME.FullScreen = NOT ME.Fullscreen
panSelect.Visible = NOT ME.FullScreen
ENDIF

IF NOT MMain.ShowLogo THEN
' right arrow
IF Key.Code = Key.Right THEN currentDoc.MoveNext()
' left arrow
IF Key.code = Key.Left THEN currentDoc.MovePrev()
ELSE
IF Key.Code = Key.Space THEN currentLogo.Quit()
ENDIF

END

PUBLIC SUB glaPresentation_Resize()

IF NOT currentDoc THEN RETURN

IF MMain.ShowLogo THEN
currentLogo.Resize(glaPresentation.Width, glaPresentation.Height)
ELSE
currentDoc.Resize(glaPresentation.Width, glaPresentation.Height)
ENDIF

END

PUBLIC SUB Form_Open()

glaPresentation.SetFocus

END

PUBLIC SUB timUpdate_Timer()

glaPresentation.Refresh

END

PUBLIC SUB btnPath_Click()

DIM sPath AS STRING

Dialog.Title = ("Select a PDF file")
Dialog.Filter = ["*.pdf", ("PDF files")]
IF Dialog.OpenFile() THEN RETURN
sPath = Dialog.Path
txtPath.Text = sPath

timUpdate.Stop

CurrentDoc = NEW CpdfPresentation(sPath, MMain.FrameRate)
currentDoc.Effect = currentDoc.Rotate

currentLogo = NEW Clogo(MMain.FrameRate)

glaPresentation_Resize

timUpdate.Delay = 1000 / MMain.FrameRate
PRINT ("Frame rate is") & " "; Format(1000 / timUpdate.Delay, "#.##"); " " & ("images by second")
timUpdate.Start

glaPresentation.SetFocus

END

PUBLIC SUB glaPresentation_MouseWheel()

IF NOT currentDoc THEN RETURN
IF MMain.ShowLogo THEN RETURN

IF Mouse.Delta < 0 THEN
currentDoc.ZoomIn
ELSE
currentDoc.ZoomOut
ENDIF

END

PUBLIC SUB btnHelp_Click()

Message(("<h2>PDFPresentation example</h2><i>Made by Laurent Carlier & Benoît Minisini.</i><p>" & "<br>" &
("Select a PDF file, then press SPACE.<br>Use the left and right arrows to flick through the document."))
glaPresentation.SetFocus

END

DnsClient



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

'[b][/b]*******************************
' We define 7 dns objects
'***********************************
PRIVATE A AS DnsClient
PRIVATE B AS DnsClient
PRIVATE C AS DnsClient
PRIVATE D AS DnsClient
PRIVATE E AS DnsClient
PRIVATE F AS DnsClient
PRIVATE G AS DnsClient

PRIVATE Working AS INTEGER
PRIVATE sNoResult AS STRING = ("Not Found")

PUBLIC SUB Button1_Click()

Label2.Text = ""
Label3.Text = ""
Label4.Text = ""
Label6.Text = ""
Label7.Text = ""
Label8.Text = ""
Label9.Text = ""
Working = 7
Button1.Enabled = FALSE
Button1.Enabled = FALSE
ComboBox1.Enabled = FALSE
Button3.Enabled = FALSE
CheckBox1.Enabled = FALSE
Label5.Text = "|"
Timer1.Delay = 200
Timer1.Enabled = TRUE
SELECT CASE ComboBox1.Index
CASE 0
A.HostName = TextBox1.Text
B.HostName = TextBox2.Text
C.HostName = TextBox3.Text
D.HostName = TextBox4.Text
E.HostName = TextBox5.Text
F.HostName = TextBox6.Text
G.HostName = TextBox7.Text
A.GetHostIP()
B.GetHostIP()
C.GetHostIP()
D.GetHostIP()
E.GetHostIP()
F.GetHostIP()
G.GetHostIP()
CASE 1
A.HostIP = TextBox1.Text
B.HostIP = TextBox2.Text
C.HostIP = TextBox3.Text
D.HostIP = TextBox4.Text
E.HostIP = TextBox5.Text
F.HostIP = TextBox6.Text
G.HostIP = TextBox7.Text
A.GetHostName()
B.GetHostName()
C.GetHostName()
D.GetHostName()
E.GetHostName()
F.GetHostName()
G.GetHostName()
END SELECT

END

PUBLIC SUB A_Finished()

SELECT CASE ComboBox1.index
CASE 0
IF A.HostIP = "" THEN
Label2.Text = sNoResult
ELSE
Label2.Text = A.HostIP
END IF
CASE 1
IF A.HostName = "" THEN
Label2.Text = sNoResult
ELSE
Label2.Text = A.HostName
END IF
END SELECT
Working = working - 1

END

PUBLIC SUB B_Finished()

SELECT CASE ComboBox1.index
CASE 0
IF B.HostIP = "" THEN
Label3.Text = sNoResult
ELSE
Label3.Text = B.HostIP
END IF
CASE 1
IF B.HostName = "" THEN
Label3.Text = sNoResult
ELSE
Label3.Text = B.HostName
END IF
END SELECT
Working = working - 1

END

PUBLIC SUB C_Finished()

SELECT CASE ComboBox1.index
CASE 0
IF C.HostIP = "" THEN
Label4.Text = sNoResult
ELSE
Label4.Text = C.HostIP
END IF
CASE 1
IF C.HostName = "" THEN
Label4.Text = sNoResult
ELSE
Label4.Text = C.HostName
END IF
END SELECT
Working = working - 1

END

PUBLIC SUB D_Finished()

SELECT CASE ComboBox1.index
CASE 0
IF D.HostIP = "" THEN
Label6.Text = sNoResult
ELSE
Label6.Text = D.HostIP
END IF
CASE 1
IF D.HostName = "" THEN
Label6.Text = sNoResult
ELSE
Label6.Text = D.HostName
END IF
END SELECT
Working = working - 1

END

PUBLIC SUB E_Finished()

SELECT CASE ComboBox1.index
CASE 0
IF E.HostIP = "" THEN
Label7.Text = sNoResult
ELSE
Label7.Text = E.HostIP
END IF
CASE 1
IF E.HostName = "" THEN
Label7.Text = sNoResult
ELSE
Label7.Text = E.HostName
END IF
END SELECT
Working = working - 1

END

PUBLIC SUB F_Finished()

SELECT CASE ComboBox1.index
CASE 0
IF F.HostIP = "" THEN
Label8.Text = sNoResult
ELSE
Label8.Text = F.HostIP
END IF
CASE 1
IF F.HostName = "" THEN
Label8.Text = sNoResult
ELSE
Label8.Text = F.HostName
END IF
END SELECT
Working = working - 1

END

PUBLIC SUB G_Finished()

SELECT CASE ComboBox1.index
CASE 0
IF G.HostIP = "" THEN
Label9.Text = sNoResult
ELSE
Label9.Text = G.HostIP
END IF
CASE 1
IF G.HostName = "" THEN
Label9.Text = sNoResult
ELSE
Label9.Text = G.HostName
END IF
END SELECT
Working = working - 1

END

PUBLIC SUB Timer1_Timer()

Timer1.Enabled = FALSE
IF Working = 0 THEN
Label5.Text = ("Finished")
Button1.Enabled = TRUE
Button3.Enabled = TRUE
ComboBox1.Enabled = TRUE
CheckBox1.Enabled = TRUE
ELSE
SELECT CASE Label5.Text
CASE "|"
Label5.Text = "/"
CASE "/"
Label5.Text = "-"
CASE "-"
Label5.Text = "\\"
CASE "\\"
Label5.Text = "|"
END SELECT
Timer1.Delay = 200
Timer1.Enabled = TRUE

END IF

END

PUBLIC SUB Button2_Click()

IF Timer1.Enabled = TRUE THEN
Timer1.Enabled = FALSE
A.Stop()
B.Stop()
C.Stop()
D.Stop()
E.Stop()
F.Stop()
G.Stop()
Label5.Text = ("Cancelled")
Working = 0
Button1.Enabled = TRUE
ComboBox1.Enabled = TRUE
Button3.Enabled = TRUE
CheckBox1.Enabled = TRUE
END IF

END

PUBLIC SUB Form_Open()

A = NEW DnsClient AS "A"
B = NEW DnsClient AS "B"
C = NEW DnsClient AS "C"
D = NEW DnsClient AS "D"
E = NEW DnsClient AS "E"
F = NEW DnsClient AS "F"
G = NEW DnsClient AS "G"
CheckBox1_Click
ComboBox1_Click
Working = 0

END

PUBLIC SUB ComboBox1_Click()

SELECT CASE ComboBox1.Index
CASE 0
Label1.Text = ("Write here 7 host names then press GO!")
CASE 1
Label1.Text = ("Write here 7 IP addresses then press GO!")
END SELECT

END

PUBLIC SUB Button3_Click()

TextBox1.Text = Label2.Text
TextBox2.Text = Label3.Text
TextBox3.Text = Label4.Text
TextBox4.Text = Label6.Text
TextBox5.Text = Label7.Text
TextBox6.Text = Label8.Text
TextBox7.Text = Label9.Text

END

PUBLIC SUB CheckBox1_Click()

A.ASync = CheckBox1.Value
B.ASync = CheckBox1.Value
C.ASync = CheckBox1.Value
D.ASync = CheckBox1.Value
E.ASync = CheckBox1.Value
F.ASync = CheckBox1.Value
G.ASync = CheckBox1.Value

END

HTTPGet



HTTPPost



POPMailbox



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

PUBLIC SUB Form_Open()

Settings.Read(FMain)

FSettings.ShowModal()

MailClient.Debug = TRUE

'Connect()

IF NOT MailClient.User THEN ME.Close

END

PUBLIC SUB btnSettings_Click()

IF MailClient.Status <> Net.Connected THEN
FSettings.ShowModal()
ENDIF

END

PUBLIC SUB btnConnect_Click()

Connect()

END

PRIVATE SUB Connect()

'Wait 0.5

INC Application.Busy

IF MailClient.Host THEN
btnSettings.Enabled = FALSE
MailClient.Open()
ENDIF

IF MailClient.Status = Net.Connected THEN
LoadInbox()
btnDisconnect.Enabled = TRUE
ELSE
btnSettings.Enabled = TRUE
Message.Warning(("Login failed!"))
ENDIF

DEC Application.Busy

END

PRIVATE SUB LoadInbox()

DIM oMail AS _Pop3Client_Message

IF MailClient.Status <> Net.Connected THEN RETURN

FOR EACH oMail IN MailClient

IF oMail.Index = 3 THEN RETURN

lvInbox.Add(oMail.Index, Subst("&1 &2", oMail.Message.Sender, oMail.Message.Subject))

WAIT

NEXT

END

PUBLIC SUB btnDisconnect_Click()

IF MailClient.Status <> Net.Connected THEN RETURN

lvInbox.Clear()

MailClient.Close()

btnDisconnect.Enabled = FALSE

btnSettings.Enabled = TRUE

END

PUBLIC SUB lvInbox_Select()

''Please note that this is not an example of the gb.mime component!!!
txtContent.Text = MailClient[lvInbox.Key].Message.Body[0].ToString()

''THIS SHOULD WORK!!!
'txtContent.Text = Mime.Decode(MailClient[lvInbox.Key].Message.Body[0].ToString(), MailClient[lvInbox.Key].Message.Body[0].ContentEncoding)

END

PUBLIC SUB Form_Close()

IF btnDisconnect.Enabled THEN
MailClient.Close()
ENDIF

Settings.Write(FMain)

END

SerialPort



ServerSocket



UDPServerClient



WebBrowser



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
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
' Gambas class file

'Static Private $aZoom As Float[]

'Private $sStatus As String
'Private $iZoom As Integer
'Private $iHidden As Integer
PRIVATE $sLastLink AS STRING

' Static Public Sub _init()
'
' Dim iInd As Integer
'
' $aZoom = New Float[17]
'
' For iInd = 0 To $aZoom.Max
' $aZoom[iInd] = 2 ^ (- (iInd - $aZoom.Max / 2) / 4)
' Next
'
' End

PUBLIC SUB Form_Open()

WebSettings.IconDatabase.Path = File.Dir(File.Dir(Temp$()))
WebSettings.Fonts.FixedFont = "Monospace"
WebSettings[WebSettings.PluginsEnabled] = TRUE
WebSettings[WebSettings.JavascriptEnabled] = TRUE
WebSettings[WebSettings.JavaEnabled] = TRUE
WebSettings.Fonts.DefaultFontSize = 12
WebSettings.Fonts.DefaultFixedFontSize = 12

CreateView()
btnZoomNormal_Click
txtURL.SetFocus
tabBrowser_Click

txtURL.Text = "[url=http://gambas.sourceforge.net]http://gambas.sourceforge.net[/url]"
txtURL_Activate

END

PRIVATE SUB GetView() AS WebView

TRY RETURN tabBrowser[tabBrowser.Index].Children[0]

END

PRIVATE SUB IsLastCurrentView() AS BOOLEAN

DIM hView AS WebView = GetView()

RETURN hView = LAST

END

PUBLIC SUB WebView_Link(Url AS STRING)

IF NOT IsLastCurrentView() THEN RETURN
$sLastLink = Url
lblStatus.Text = Url

END

PUBLIC SUB WebView_Status()

IF NOT IsLastCurrentView() THEN RETURN
lblStatus.Text = GetView().Status

END

PUBLIC SUB WebView_Progress()

GetView().Status = ("Loading...")
IF NOT IsLastCurrentView() THEN RETURN

lblStatus.Text = GetView().Status
pgbLoad.Value = GetView().Progress
panLoad.Show

END

PUBLIC SUB WebView_Error()

DIM hView AS WebView = GetView()
DIM sUrl AS STRING

sUrl = $sLastLink
IF NOT sUrl THEN sUrl = txtURL.Text

' If Not (sUrl Begins "www.") Then
' txtURL.Text = "www." & sUrl
' btnGo.Value = True
' Return
' Endif

hView.Status = ("Unable to load:") & " " & sUrl
hView.HTML = ("<h3>Unable to find the following URL:</h3>") & sUrl
IF NOT IsLastCurrentView() THEN RETURN

lblStatus.Text = GetView().Status
pgbLoad.Hide

END

PUBLIC SUB WebView_Load()

'Dim iInd As Integer
DIM hView AS WebView = GetView()
DIM hIcon AS Picture

hView.Status = ""
hIcon = hView.Icon 'WebSettings.IconDatabase[hView.Url]
tabBrowser[hView.Tag].Picture = hIcon

IF NOT IsLastCurrentView() THEN RETURN

lblStatus.Text = ""
txtURL.Text = hView.Url
pgbLoad.Hide

UpdateIcon

' Debug GetView().Frame
' For iInd = 0 To GetView().Frame.Children.Count - 1
' Debug "["; iInd; "] "; GetView().Frame.Children[iInd]
' Next

END

PUBLIC SUB btnGo_Click()

DIM sText AS STRING = txtURL.Text

IF InStr(sText, "://") = 0 THEN sText = "http://" & sText

$sLastLink = sText
GetView().Url = sText

END

PUBLIC SUB txtURL_Activate()

btnGo.Value = TRUE

END

PUBLIC SUB btnBack_Click()

GetView().Back

END

PUBLIC SUB btnForward_Click()

GetView().Forward

END

PUBLIC SUB btnStop_Click()

GetView().Stop

END

PUBLIC SUB btnReload_Click()

DIM hView AS WebView = GetView()

hView.Reload

END

PUBLIC SUB btnZoomIn_Click()

GetView().Zoom = Round(GetView().Zoom * 1.25, -2)

END

PUBLIC SUB btnZoomOut_Click()

GetView().Zoom = Round(GetView().Zoom / 1.25, -2)

END

PUBLIC SUB btnZoomNormal_Click()

GetView().Zoom = 1

END

PUBLIC SUB WebView_Title()

DIM hView AS WebView = LAST

tabBrowser[hView.Tag].Text = hView.Title
IF NOT IsLastCurrentView() THEN RETURN
ME.Title = hView.Title & " - Gambas WebKit"

END

PUBLIC SUB WebView_Icon()

DIM hView AS WebView = LAST
'hView.Icon.Save("~/icon.png")
tabBrowser[hView.Tag].Picture = hView.Icon
UpdateIcon

END

PUBLIC SUB btnClear_Click()

txtURL.Clear
txtURL.SetFocus

END

PUBLIC SUB WebView_NewWindow((Modal) AS BOOLEAN)

CreateView()

LAST.NewView = GetView()

END

PRIVATE SUB CreateView()

DIM iLast AS INTEGER = tabBrowser.Count - 1
DIM hView AS WebView

Object.Lock(tabBrowser)
INC tabBrowser.Count
Object.Lock(tabBrowser)
tabBrowser[iLast + 1].Picture = tabBrowser[iLast].Picture
tabBrowser[iLast + 1].Text = tabBrowser[iLast].Text
tabBrowser[iLast].Text = ""
tabBrowser[iLast].Picture = NULL
tabBrowser[iLast].Closable = TRUE
Object.Lock(tabBrowser)
tabBrowser.Index = iLast
hView = NEW WebView(tabBrowser) AS "WebView"
hView.Tag = tabBrowser.Index
hView.Editable = btnEdit.Value
hView.Resize(1, 1)
'hView.Show
'Print WebSettings.Fonts.FixedFont
Object.Unlock(tabBrowser)
Object.Unlock(tabBrowser)
Object.Unlock(tabBrowser)
tabBrowser_Click
txtURL.SetFocus

END

PUBLIC SUB tabBrowser_Click()

DIM iLast AS INTEGER = tabBrowser.Count - 1
DIM hView AS WebView

IF tabBrowser.Index = iLast THEN
CreateView()
ELSE
hView = GetView()
IF hView.Title THEN
ME.Title = hView.Title & " - Gambas WebKit"
ELSE
ME.Title = "Gambas WebKit"
ENDIF
tabBrowser.Text = hView.Title
UpdateIcon
tabBrowser.Picture = hView.Icon
txtURL.Text = hView.Url
lblStatus.Text = hView.Status
pgbLoad.Value = hView.Progress
IF hView.Progress > 0 AND IF hView.Progress < 1 THEN
panLoad.Show
ELSE
panLoad.Hide
ENDIF
ENDIF

END

PUBLIC SUB btnDownloadList_Click()

FDownloadList.Show

END

PUBLIC SUB WebView_Auth()

DIM hView AS WebView = LAST

IF NOT FAuth.Run(hView.Auth.Url, hView.Auth.Realm) THEN

hView.Auth.User = FAuth.User
hView.Auth.Password = FAuth.Password
'Debug hView.Auth.Url;; hView.Auth.User;; hView.Auth.Password

ENDIF

END

PUBLIC SUB WebView_Click(Frame AS WebFrame)

DIM sName AS STRING = Frame.Name

IF sName THEN sName &= ": "
DEBUG sName; Frame.Url

END

PUBLIC SUB WebView_NewFrame(Frame AS WebFrame)

DEBUG Frame.Name

END

PUBLIC SUB WebView_Download(Download AS WebDownload)

Dialog.Path = System.User.Home &/ File.Name(Download.Url)
IF NOT Dialog.SaveFile() THEN
Download.Path = Dialog.Path
FDownloadList.AddDownload(Download)
FDownloadList.Show
ENDIF

END

PUBLIC SUB WebView_MouseDown()

DIM hView AS WebView = LAST
DIM hTest AS WebHitTest = hView.HitTest(Mouse.X, Mouse.Y)
DIM sMsg AS STRING

IF hTest.Document THEN sMsg &= "DOCUMENT "
IF hTest.Link THEN sMsg &= "LINK "
IF hTest.Image THEN sMsg &= "IMAGE "
IF hTest.Selected THEN sMsg &= "SELECTED "
IF hTest.Editable THEN sMsg &= "EDITABLE "
DEBUG sMsg; hTest.Url

END

PUBLIC SUB tabBrowser_Close(Index AS INTEGER)

DIM hView AS WebView

TRY hView = tabBrowser[Index].Children[0]
IF NOT hView THEN RETURN

hView.Delete

Object.Lock(tabBrowser)
tabBrowser[Index].Delete
Object.UnLock(tabBrowser)
IF Index = tabBrowser.Index THEN
IF tabBrowser.Index = (tabBrowser.Count - 1) AND IF tabBrowser.Index > 0 THEN
tabBrowser.Index = tabBrowser.Index - 1
ELSE
tabBrowser_Click
ENDIF
ENDIF

END

PUBLIC SUB btnFind_Click()

DIM hView AS WebView = GetView()

panFind.Visible = btnFind.Value
IF btnFind.Value THEN
DoFind
txtFind.SetFocus
ELSE
hView.FindText("")
ENDIF

END

PRIVATE SUB DoFind(OPTIONAL bBackward AS BOOLEAN)

DIM hView AS WebView = GetView()
DIM sText AS STRING

sText = Trim(txtFind.Text)

IF sText AND IF hView.FindText(sText, bBackward, chkCaseSensitive.Value, TRUE) THEN ', chkHighlight.Value) Then
panFind.Background = &HFFDFDF
ELSE
panFind.Background = Color.Default
IF NOT sText THEN hView.FindText("")
ENDIF

END

PUBLIC SUB txtFind_Change()

DoFind

END

PUBLIC SUB Form_KeyPress()

IF Key.Control AND IF Key.Code = Key["F"] THEN
btnFind.Value = TRUE
ELSE IF Key.Code = Key.Escape THEN
btnFind.Value = FALSE
ELSE IF Key.Code = Key.F3 THEN
DoFind(Key.Shift)
ENDIF

END

PUBLIC SUB chkCaseSensitive_Click()

DoFind

END

PUBLIC SUB chkHighlight_Click()

DIM hView AS WebView

IF NOT chkHighlight.Value THEN
hView = GetView()
hView.FindText("",,,, TRUE)
ELSE
DoFind
ENDIF

END

PUBLIC SUB btnNext_Click()

DoFind

END

PUBLIC SUB btnPrevious_Click()

DoFind(TRUE)

END

PUBLIC SUB btnClearFind_Click()

txtFind.Text = ""

END

PUBLIC SUB txtFind_Activate()

DoFind

END

PRIVATE SUB UpdateIcon()

DIM hView AS WebView = GetView()
DIM hIcon AS Picture

hIcon = hView.Icon 'WebSettings.IconDatabase[hView.Url]

IF hIcon THEN
ME.Icon = hIcon
ELSE
ME.Icon = Picture["icon:/16/internet"]
ENDIF

END

PUBLIC SUB btnConfig_Click()

WITH WebSettings.Proxy

FOption.Type = .Type
FOption.Host = .Host
FOption.Port = .Port
FOption.User = .User
FOption.Password = .Password

IF FOption.Run() THEN RETURN

.Type = FOption.Type
.Host = FOption.Host
.Port = FOption.Port
.User = FOption.User
.Password = FOption.Password

END WITH

END

PUBLIC SUB btnEdit_Click()

DIM hWebView AS WebView

FOR EACH hWebView IN tabBrowser.Children
hWebView.Editable = btnEdit.Value
NEXT

WebSettings[WebSettings.JavascriptCanAccessClipboard] = btnEdit.Value
panEdit.Visible = btnEdit.Value

END

PUBLIC SUB btnAction_Click()

DIM hWebView AS WebView = GetView()

DEBUG "Action " & LAST.Tag & ": "; hWebView.Eval(Subst("document.execCommand('&1', false, false)", LAST.Tag))

END

PUBLIC SUB btnColor_Click()

DIM hWebView AS WebView = GetView()

IF Dialog.SelectColor() THEN RETURN
hWebView.Eval(Subst("document.execCommand('forecolor', false, '&1')", "#" & Hex$(Dialog.Color, 6)))

END

PUBLIC SUB mnuFont_Show()

DIM sFont AS STRING
DIM hMenu AS Menu

IF mnuFont.Children.Count > 1 THEN RETURN

mnuFont.Children.Clear

FOR EACH sFont IN Fonts

hMenu = NEW Menu(mnuFont) AS "mnuSelectFont"
hMenu.Text = sFont

NEXT

END

PUBLIC SUB mnuSelectFont_Click()

DIM hWebView AS WebView = GetView()
DIM sFont AS STRING = LAST.Text

hWebView.Eval(Subst("document.execCommand('fontname', false, '&1')", sFont))

END

PUBLIC SUB btnBackground_Click()

DIM hWebView AS WebView = GetView()

Dialog.Title = ("Select a color")
IF Dialog.SelectColor() THEN RETURN
hWebView.Eval(Subst("document.execCommand('backcolor', false, '&1')", "#" & Hex$(Dialog.Color, 6)))

END

PUBLIC SUB mnuSelectSize_Click()

DIM hWebView AS WebView = GetView()
DIM sSize AS STRING = LAST.Text

hWebView.Eval(Subst("document.execCommand('fontsize', false, '&1')", sSize))

END

PUBLIC SUB btnInsertImage_Click()

DIM hWebView AS WebView = GetView()

Dialog.Title = ("Select an image")
Dialog.Filter = ["*.jpg;*.jpeg;*.png;*.gif;*.xpm;*.bmp", "Image files"]
IF Dialog.OpenFile() THEN RETURN

PRINT Dialog.Path
hWebView.Eval(Subst("document.execCommand('insertImage', false, '&1')", "file://" & Replace(Dialog.Path, "'", "\\'")))

END


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

Navigation :



<-- Accueil du WIKI : <--

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

Documentation :



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