-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathConfColores.frm
365 lines (324 loc) · 11 KB
/
ConfColores.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
VERSION 5.00
Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
Begin VB.Form frmConfColores
BorderStyle = 3 'Fixed Dialog
Caption = "Configuración de Colores"
ClientHeight = 5610
ClientLeft = 900
ClientTop = 1650
ClientWidth = 4935
Icon = "ConfColores.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 374
ScaleMode = 3 'Pixel
ScaleWidth = 329
ShowInTaskbar = 0 'False
Begin VB.PictureBox picDraw
Appearance = 0 'Flat
AutoRedraw = -1 'True
BackColor = &H80000005&
ForeColor = &H00C0FFFF&
Height = 5535
Left = 0
ScaleHeight = 367
ScaleMode = 3 'Pixel
ScaleWidth = 22
TabIndex = 10
Top = 0
Width = 360
End
Begin VB.CommandButton cmdAccion
Caption = "&Editar"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 435
Index = 5
Left = 3585
TabIndex = 9
ToolTipText = "Editar instruaccion SQL"
Top = 2670
Width = 1245
End
Begin VB.CommandButton cmdAccion
Caption = "A&plicar"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 435
Index = 4
Left = 3585
TabIndex = 8
ToolTipText = "Aplicar cambios a hojas de consultas activas"
Top = 2190
Width = 1245
End
Begin VB.CommandButton cmdAccion
Caption = "&Eliminar"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 435
Index = 3
Left = 3585
TabIndex = 7
ToolTipText = "Eliminar instruccion SQL de lista"
Top = 1710
Width = 1245
End
Begin VB.CommandButton cmdAccion
Caption = "&Color"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 435
Index = 2
Left = 3585
TabIndex = 6
ToolTipText = "Configurar color de instruccion SQL"
Top = 1230
Width = 1245
End
Begin VB.CommandButton cmdAccion
Caption = "&Agregar"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 435
Index = 1
Left = 3585
TabIndex = 5
ToolTipText = "Agregar instruccon SQL"
Top = 750
Width = 1245
End
Begin VB.CommandButton cmdAccion
Caption = "&Salir"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 435
Index = 0
Left = 3585
TabIndex = 4
ToolTipText = "Salir de la pantalla"
Top = 270
Width = 1245
End
Begin RichTextLib.RichTextBox rtb
Height = 2145
Left = 405
TabIndex = 2
Top = 3420
Width = 4425
_ExtentX = 7805
_ExtentY = 3784
_Version = 393217
TextRTF = $"ConfColores.frx":08CA
End
Begin VB.ListBox lis
Height = 2790
Left = 405
TabIndex = 1
Top = 270
Width = 3075
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "Instrucción SQL"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 195
Left = 435
TabIndex = 3
Top = 3150
Width = 1380
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "Sentencias registradas"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 195
Left = 405
TabIndex = 0
Top = 30
Width = 1950
End
End
Attribute VB_Name = "frmConfColores"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private mGradient As New clsGradient
Private Sub cmdAccion_Click(Index As Integer)
Dim Color As Long
Dim Sentencia As String
Dim OldSentencia As String
Dim msg As String
Dim k As Integer
Dim j As Integer
Dim Sql As String
Sql = rtb.Text
Select Case Index
Case 0 'Salir
Unload Me
Case 1 'Agregar
Sentencia = InputBox("Digite sentencia a agregar", App.Title)
If Sentencia <> "" Then
lis.AddItem Sentencia
rtb.Text = Sql & Sentencia & " "
Call CargaSentencias
End If
Case 2 'Color
If lis.ListIndex <> -1 Then
Sentencia = lis.Text
Color = ShowColor(hwnd)
If Color <> -1 Then
Call ColorSQL(rtb, Sentencia, Color)
lis.itemData(lis.ListIndex) = Color
Call ColorSQL(rtb, Sentencia, Color)
End If
Else
MsgBox "Seleccione sentencia.", vbInformation
End If
Case 3 'Eliminar
If lis.ListIndex <> -1 Then
Sentencia = lis.Text
msg = "Confirma eliminar sentencia : " & Sentencia
If Confirma(msg) = vbNo Then Exit Sub
lis.RemoveItem lis.ListIndex
Sentencia = ""
For k = 0 To lis.ListCount - 1
Sentencia = Sentencia & lis.List(k) & " "
Next k
rtb.Text = Sentencia
End If
Case 4 'Aplicar
Dim f As Form
ReDim aSentencias(0)
For k = 0 To lis.ListCount - 1
Sentencia = lis.List(k)
Color = lis.itemData(k)
ReDim Preserve aSentencias(k + 1)
aSentencias(k + 1).Glosa = Sentencia
aSentencias(k + 1).Color = Color
Call GrabaIni(C_INI, "Sentencias", "Sentencia" & k + 1, Sentencia)
Call GrabaIni(C_INI, "Sentencias", "Color" & k + 1, Color)
Next k
Call GrabaIni(C_INI, "Sentencias", "nSentencias", CStr(UBound(aSentencias)))
Dim ArrayCount As Integer
ArrayCount = UBound(Document)
For k = 1 To ArrayCount
If Not fState(k).Deleted Then
Set f = Document(k)
For j = 1 To UBound(aSentencias)
Call ColorSQL(f.txtQuery, aSentencias(j).Glosa, aSentencias(j).Color)
Next j
End If
Next
Set f = Nothing
Unload Me
Case 5 'Editar
If lis.ListIndex <> -1 Then
OldSentencia = lis.Text
Sentencia = InputBox("Editar sentencia ", App.Title, OldSentencia)
If Sentencia <> "" Then
lis.Text = Sentencia
rtb.Text = Sql & Sentencia
End If
End If
End Select
End Sub
Private Sub Form_Load()
Dim k As Integer
Dim Sql As String
CenterWindow hwnd
For k = 1 To UBound(aSentencias)
Sql = Sql & aSentencias(k).Glosa & " "
Next k
rtb.Text = Sql
For k = 1 To UBound(aSentencias)
lis.AddItem aSentencias(k).Glosa
lis.itemData(lis.NewIndex) = aSentencias(k).Color
Next k
Call CargaSentencias
With mGradient
.Angle = 90 '.Angle
.Color1 = 16744448
.Color2 = 0
.Draw picDraw
End With
Call FontStuff(picDraw, "Configurar SQL")
picDraw.Refresh
End Sub
Private Sub CargaSentencias()
Dim k As Integer
Dim CHARRANGE As ECharrange
Dim ret As Long
ret = SendMessage(rtb.hwnd, EM_EXGETSEL, 0, CHARRANGE)
For k = 1 To UBound(aSentencias)
Call ColorSQL(rtb, aSentencias(k).Glosa, aSentencias(k).Color)
Next k
rtb.SelColor = glbColorSql
rtb.SelStart = CHARRANGE.cpMin
rtb.SelLength = 0
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set mGradient = Nothing
Set frmConfColores = Nothing
End Sub