-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMdi.bas
142 lines (106 loc) · 3.37 KB
/
Mdi.bas
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
Attribute VB_Name = "mMdi"
Option Explicit
Type FormState
Deleted As Integer
Dirty As Integer
Color As Long
Tag As Variant
End Type
Type TablasState
Deleted As Integer
Dirty As Integer
Color As Long
Tag As Variant
End Type
Public fState() As FormState
Public Document() As New frmQuery
Public fTablasState As TablasState
Public Tablas() As New frmTablas
Public gbMatchCase As Integer
Public gbWholeWord As Integer
Public gsFindText As String
Public gbLastPos As Integer
Public glbFindSql As String
Sub FindText()
On Local Error GoTo SalirFindText
Dim lWhere, lPos As Long
Dim sTmp As String
Dim Sql As String
'Dim iComp As Integer
'If gbMatchCase = 0 Then iComp = 1 Else iComp = 0
Sql = UCase$(glbFindSql)
If gbLastPos = 0 Or gbLastPos > Len(Sql) Then
lPos = 1
Else
lPos = gbLastPos
End If
Do While lPos < Len(Sql)
sTmp = Mid(Sql, lPos, Len(Sql))
lWhere = InStr(sTmp, UCase$(gsFindText))
lPos = lPos + lWhere
If lWhere Then ' If found,
frmMain.ActiveForm.SetFocus
frmMain.ActiveForm!txtQuery.SelStart = lPos - 2 ' set selection start and
frmMain.ActiveForm!txtQuery.SelLength = Len(gsFindText) ' set selection length. Else
gbLastPos = lPos
Exit Do
Else
gbLastPos = 0
Exit Do 'we are ready
End If
Loop
Exit Sub
SalirFindText:
gbLastPos = 0
Err = 0
End Sub
Sub FileNew(Optional Index)
Dim fIndex As Integer
Dim i As Integer
' Find the next available index and show the child form.
fIndex = FindFreeIndex()
fState(fIndex).Tag = "q" & fIndex
fState(fIndex).Dirty = fIndex
Document(fIndex).Caption = "Query : " & fIndex
Document(fIndex).Tag = "q" & fIndex
Document(fIndex).Show
Call CargaConexiones
Exit Sub
Dim f As Form
Dim ci As ComboItem
Dim ArrayCount As Integer
Dim ArrayDoc As Integer
ArrayCount = UBound(DBConnection)
ArrayDoc = UBound(Document)
Set f = Document(fIndex)
f.imgConexiones.ComboItems.Clear
For i = 1 To ArrayCount
If Not cState(i).Deleted Then
Set ci = f.imgConexiones.ComboItems.Add(1, cState(i).Conexion, _
cState(i).Conexion, 2, 2, 0)
ci.Indentation = 2
End If
Next i
Index = fIndex
End Sub
Function FindFreeIndex() As Integer
Dim i As Integer
Dim ArrayCount As Integer
ArrayCount = UBound(Document)
' Cycle through the document array. If one of the
' documents has been deleted, then return that index.
For i = 1 To ArrayCount
If fState(i).Deleted Then
FindFreeIndex = i
fState(i).Deleted = False
Exit Function
End If
Next
' If none of the elements in the document array have
' been deleted, then increment the document and the
' state arrays by one and return the index to the
' new element.
ReDim Preserve Document(ArrayCount + 1)
ReDim Preserve fState(ArrayCount + 1)
FindFreeIndex = UBound(Document)
End Function