-
Notifications
You must be signed in to change notification settings - Fork 2
/
FRMLISTB.FRM
493 lines (437 loc) · 14.2 KB
/
FRMLISTB.FRM
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
VERSION 5.00
Object = "{246E535D-09D2-4109-80DA-2FF183F4D185}#2.1#0"; "colorpick.ocx"
Object = "{FCFAF346-DE8A-4FB6-8612-5000548EFDC7}#2.0#0"; "vbsListView6.ocx"
Begin VB.Form frmHtmlListbox
BorderStyle = 3 'Fixed Dialog
Caption = "Listbox"
ClientHeight = 6270
ClientLeft = 5115
ClientTop = 2175
ClientWidth = 6495
Icon = "FRMLISTB.frx":0000
KeyPreview = -1 'True
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
PaletteMode = 1 'UseZOrder
ScaleHeight = 6270
ScaleWidth = 6495
ShowInTaskbar = 0 'False
Begin VB.CommandButton cmd
Caption = "&More ..."
Height = 375
Index = 6
Left = 4920
TabIndex = 25
Top = 5760
Width = 1215
End
Begin VB.CommandButton cmd
Caption = "&Events"
Height = 375
Index = 5
Left = 3360
TabIndex = 24
Top = 5760
Width = 1215
End
Begin VB.CommandButton cmd
Caption = "&Cancel"
Height = 375
Index = 1
Left = 1800
TabIndex = 20
Top = 5760
Width = 1215
End
Begin VB.CommandButton cmd
Caption = "&Ok"
Height = 375
Index = 0
Left = 240
TabIndex = 19
Top = 5760
Width = 1215
End
Begin VB.Frame fra
Caption = "Extras"
Height = 1005
Index = 2
Left = 45
TabIndex = 14
Top = 1785
Width = 6375
Begin VB.CommandButton cmd
Caption = "..."
Height = 255
Index = 8
Left = 5760
TabIndex = 26
Top = 600
Width = 375
End
Begin VB.TextBox Text1
Height = 285
Left = 1635
TabIndex = 5
Top = 600
Width = 4080
End
Begin VB.TextBox txtColorText
Height = 285
Left = 1635
Locked = -1 'True
TabIndex = 4
Top = 270
Width = 885
End
Begin ColorPick.ClrPicker ClrPicker1
Height = 300
Left = 2550
TabIndex = 17
Top = 270
Width = 315
_ExtentX = 556
_ExtentY = 529
End
Begin VB.Label lbl
Appearance = 0 'Flat
AutoSize = -1 'True
BackColor = &H80000005&
BackStyle = 0 'Transparent
Caption = "Background Image"
ForeColor = &H80000008&
Height = 195
Index = 4
Left = 135
TabIndex = 16
Top = 585
Width = 1350
End
Begin VB.Label lbl
Appearance = 0 'Flat
AutoSize = -1 'True
BackColor = &H80000005&
BackStyle = 0 'Transparent
Caption = "Background Color"
ForeColor = &H80000008&
Height = 195
Index = 2
Left = 135
TabIndex = 15
Top = 285
Width = 1275
End
End
Begin VB.Frame fra
Caption = "Events"
Height = 690
Index = 3
Left = 45
TabIndex = 12
Top = 4950
Width = 6360
Begin VB.CommandButton cmd
Caption = "&Delete"
Height = 375
Index = 4
Left = 5640
TabIndex = 23
Top = 240
Width = 615
End
Begin VB.ComboBox cboEvents
ForeColor = &H00000000&
Height = 315
Left = 705
Style = 2 'Dropdown List
TabIndex = 6
Top = 255
Width = 4860
End
Begin VB.Label lbl
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Current"
Height = 195
Index = 6
Left = 135
TabIndex = 13
Top = 285
Width = 510
End
End
Begin VB.Frame fra
Caption = "ListBox Items"
Height = 2115
Index = 1
Left = 45
TabIndex = 11
Top = 2820
Width = 6360
Begin VB.CommandButton cmd
Caption = "&Remove"
Height = 255
Index = 3
Left = 2640
TabIndex = 22
Top = 1680
Width = 1215
End
Begin vbalListViewLib6.vbalListViewCtl lvwchk
Height = 1395
Left = 105
TabIndex = 18
Top = 195
Width = 6075
_ExtentX = 10716
_ExtentY = 2461
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
View = 1
MultiSelect = -1 'True
LabelEdit = 0 'False
GridLines = -1 'True
FullRowSelect = -1 'True
AutoArrange = 0 'False
FlatScrollBar = -1 'True
HeaderButtons = 0 'False
HeaderTrackSelect= 0 'False
HideSelection = 0 'False
InfoTips = 0 'False
End
End
Begin VB.Frame fra
Caption = "Settings"
Height = 1710
Index = 0
Left = 45
TabIndex = 7
Top = 60
Width = 6375
Begin VB.CommandButton cmd
Caption = "&Add"
Height = 255
Index = 2
Left = 2640
TabIndex = 21
Top = 1320
Width = 1215
End
Begin VB.TextBox txtNombre
Height = 285
Left = 795
TabIndex = 0
Top = 270
Width = 5475
End
Begin VB.TextBox txtValor
Height = 285
Left = 795
TabIndex = 2
Top = 960
Width = 5460
End
Begin VB.TextBox txtTam
Height = 285
Left = 795
TabIndex = 1
Top = 615
Width = 495
End
Begin VB.CheckBox chk
Caption = "Multiple Select"
Height = 240
Left = 795
TabIndex = 3
Top = 1305
Width = 1695
End
Begin VB.Label lbl
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Name"
Height = 195
Index = 0
Left = 135
TabIndex = 10
Top = 285
Width = 420
End
Begin VB.Label lbl
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Value"
Height = 195
Index = 1
Left = 135
TabIndex = 9
Top = 1035
Width = 405
End
Begin VB.Label lbl
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Height"
Height = 195
Index = 3
Left = 135
TabIndex = 8
Top = 630
Width = 465
End
End
End
Attribute VB_Name = "frmHtmlListbox"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Agregar()
Dim k As Integer
If txtNombre.Text = "" Then
MsgBox "The name for this element.", vbCritical
txtNombre.SetFocus
Exit Sub
End If
If txtValor.Text = "" Then
MsgBox "The value for this element.", vbCritical
txtValor.SetFocus
Exit Sub
End If
k = lvwchk.ListItems.count + 1
lvwchk.ListItems.Add , "k" & k, txtNombre.Text
lvwchk.ListItems("k" & k).SubItems(1).Caption = txtValor.Text
txtValor.SetFocus
End Sub
Private Sub Eliminar()
If lvwchk.ListItems.count <= 0 Then
MsgBox "Nothing to do.", vbCritical
Exit Sub
End If
If Not lvwchk.SelectedItem Is Nothing Then
lvwchk.ListItems.Remove lvwchk.SelectedItem.key
End If
End Sub
Private Function InsertarListbox() As Boolean
On Error GoTo ErrorInsertarListbox
Dim k As Integer
Dim src As New cStringBuilder
Dim stam As String
If lvwchk.ListItems.count <= 0 Then
MsgBox "Nothing to do.", vbCritical
Exit Function
End If
If txtTam.Text = "" Then
stam = "3"
Else
stam = txtTam.Text
End If
src.Append "<select name=" & Chr$(34) & "listbox1" & Chr$(34)
src.Append " size=" & Chr$(34) & stam & Chr$(34)
If txtColorText.Text <> "" Then
src.Append " style=" & Chr$(34) & "background-color:" & txtColorText.Text & Chr$(34)
End If
If Text1.Text <> "" Then
src.Append " style=" & Chr$(34) & "background-image:url('" & Text1.Text & "')" & Chr$(34)
End If
If chk.Value Then
src.Append " multiple"
End If
If Len(Trim$(CComHtmlAttrib.Output)) > 0 Then
src.Append " " & Trim$(CComHtmlAttrib.Output)
End If
If Len(Trim$(CEventos.Output)) > 0 Then
src.Append " " & Trim$(CEventos.Output)
End If
src.Append ">" & vbNewLine
For k = 1 To lvwchk.ListItems.count
src.Append "<option value=" & Chr$(34) & lvwchk.ListItems(k).SubItems(1).Caption & Chr$(34) & ">"
src.Append lvwchk.ListItems(k).Text & "</option>" & vbNewLine
Next k
src.Append "</select>"
If frmMain.ActiveForm.Name = "frmEdit" Then
Call frmMain.ActiveForm.Insertar(src.ToString)
End If
Set src = Nothing
InsertarListbox = True
Exit Function
ErrorInsertarListbox:
MsgBox "InsertarListbox : " & Err & " " & Error$, vbCritical
End Function
Private Sub ClrPicker1_ColorSelected(m_Color As stdole.OLE_COLOR, m_Code As String)
txtColorText.Text = m_Code
txtColorText.Tag = m_Color
End Sub
Private Sub cmd_Click(Index As Integer)
If Index = 0 Then
If InsertarListbox() Then
Unload Me
End If
ElseIf Index = 1 Then
Unload Me
ElseIf Index = 2 Then
Call Agregar
ElseIf Index = 3 Then
Call Eliminar
ElseIf Index = 4 Then
If cboEvents.ListIndex <> -1 Then
CEventos.Remove cboEvents.Text
cboEvents.RemoveItem cboEvents.ListIndex
End If
ElseIf Index = 5 Then
frmEvents.html_tag = "ListBox"
frmEvents.Show vbModal
Call CEventos.Attach(Me.cboEvents)
ElseIf Index = 6 Then
frmCommonHtml.html_tag = "ListBox"
frmCommonHtml.Show vbModal
ElseIf Index = 7 Then
ElseIf Index = 8 Then
Dim glosa As String
Dim Archivo As String
Dim LastPath As String
glosa = "CompuServe Graphics Interchange (*.gif)|*.gif|"
glosa = glosa & "JPG (*.jpg)|*.jpg|"
glosa = glosa & "All files (*.*)|*.*"
LastPath = App.Path
If Not Cdlg.VBGetOpenFileName(Archivo, , , , , , glosa, , LastPath, "Open Image", "gif") Then
Exit Sub
End If
Text1.Text = util.VBArchivoSinPath(Archivo)
End If
End Sub
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyEscape Then
Unload Me
End If
End Sub
Private Sub Form_Load()
util.CenterForm Me
util.SetNumber txtTam.hwnd
With lvwchk
.Columns.Add , "k1", "Name", , 1440
.Columns.Add , "k2", "Value", , 4000
End With
flat_lviews Me
CEventos.Clear
CComHtmlAttrib.Clear
ClrPicker1.PathPaleta = App.Path & "\pal\256c.pal"
Debug.Print "load"
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Call clear_memory(Me)
End Sub
Private Sub Form_Unload(Cancel As Integer)
Debug.Print "unload"
Set frmHtmlListbox = Nothing
End Sub