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
| Public oForm
oForm = Createobject('htmlSample', GetHTML())
oForm.Show()
Function GetHTML
*Return HTMLShowerx()
Local myVar
TEXT to myVar noshow
<html>
<head>
<title>New User Sign Up</title>
<script language="JScript">
function LoadTreeView()
{
var TreeView1 = document.all('Tree001');
var oNode = TreeView1.Nodes.Add(null,0,"top","My Tree");
TreeView1.Nodes.Add("top",4,"root0","Main node 0");
TreeView1.Nodes.Add("top",4,"root1","Main node 1");
TreeView1.Nodes.Add("top",4,"root2","Main node 2");
TreeView1.Nodes.Add("root1",4,"child11","Child11");
TreeView1.Nodes.Add("root1",4,"child12","Child12");
TreeView1.Nodes.Add("root2",4,"child21","Child21");
TreeView1.Nodes.Add("child11",4,"child111","child111");
TreeView1.Nodes.Add("child11",4,"child113","child113");
TreeView1.Nodes.Add("child113",3,"child112","child112");
oNode.Expanded = true;
var TreeView2 = document.all('Tree002');
var oNode = TreeView2.Nodes.Add(null,0,"top","My Tree");
TreeView2.Nodes.Add("top",4,"root0","Main node 0");
TreeView2.Nodes.Add("top",4,"root1","Main node 1");
TreeView2.Nodes.Add("top",4,"root2","Main node 2");
TreeView2.Nodes.Add("root1",4,"child11","Child11");
TreeView2.Nodes.Add("root1",4,"child12","Child12");
TreeView2.Nodes.Add("root2",4,"child21","Child21");
TreeView2.Nodes.Add("child11",4,"child111","child111");
TreeView2.Nodes.Add("child11",4,"child113","child113");
TreeView2.Nodes.Add("child113",3,"child112","child112");
oNode.Expanded = true;
}
function CheckTable(dbcPath,dbfName)
{
var strCn = "Provider=VFPOLEDB;Data Source=" + dbcPath;
var strSQL = "select * from " + dbfName;
var oConn = new ActiveXObject("Adodb.Connection");
oConn.ConnectionString = strCn;
oConn.Open;
var oRS = oConn.Execute(strSQL);
var lst="<TABLE border='1'><TR>";
var Maxfields=5;
var MaxRows=20;
for (i=0;i<Math.min(oRS.Fields.Count,Maxfields);i++)
{
lst += "<TH>";
lst += oRS.Fields(i).Name;
lst += "</TH>";
}
lst += "</TR>";
var counter=0;
while (!oRS.eof && counter < MaxRows)
{
lst += "<TR>";
for (i=0;i<Math.min(oRS.Fields.Count,Maxfields);i++)
{
lst += "<TD>";
lst += oRS.Fields(i).Value;
lst += "</TD>";
}
lst += "</TR>";
oRS.MoveNext();
counter++;
}
lst += "</TABLE>";
oConn.Close();
tablelist.innerHTML = lst;
return true;
}
</script>
</head>
<body bgcolor=Turquoise onload="LoadTreeView();">
<h1 align="Center"><font color="#000080">New User Sign Up</font></h1>
<form method="GET" action="empty.htm" target="_self" name="myForm">
<table border="0" cellspacing="1">
<tr><td>ID</td><td><input type="text" name="ID" ID="SSNNumber" size="16" maxlength="16"></td></tr>
<tr><td>First Name</td><td><input type="text" name="First" size="30" maxlength="15"></td></tr>
<tr><td>Last Name</td><td><input type="text" name="Last" size="30" maxlength="20"></td></tr>
<td>Gender?</td>
<td>
<select name="Selection1">
<option value="0">- Gender -</option>
<option value="1">Female</option>
<option value="2">Male</option>
</select></td></tr>
<tr>
<td>Multi Selection</td>
<td>
<select multiple name="MulSelection">
<option value="0">- Sports you watch -</option>
<option value="1">Basketball</option>
<option value="2">Soccer</option>
<option value="3">Football</option>
<option value="4">Volleyball</option>
<option value="5">Formula1</option>
<option value="6">Nascar</option>
</select></td></tr>
</table>
<TEXTAREA ID=txtComments STYLE="overflow:scroll; width:70%; height:150">
Sometimes an HTML based VFP form can be cool.
Think you could have syntax coloring on a form :)
Play flash movie (better play "Need For Speed" - post me too if you find a flash version), have a calendar etc.
</TEXTAREA>
<p>
<A HREF="newpage.htm" TARGET="_self">Go to New Page.</A>
<input type=submit name=sub1 value="Write" onclick='document.all("submitter").value="writeButton";'>
<input type=submit name=sub2 value="Update" onclick='document.all("submitter").value="updateButton";'>
<input type=submit name=sub3 value="Clear" onclick='document.all("submitter").value="clearButton";'>
<p>
<object name="Treeview" classid="clsid:C74190B6-8589-11D1-B16A-00C0F0283628"
id="Tree001" width="242" height="159">
<param name="_ExtentX" value="6403">
<param name="_ExtentY" value="4207">
<param name="_Version" value="393217">
<param name="HideSelection" value="0">
<param name="Indentation" value="1000">
<param name="LabelEdit" value="0">
<param name="LineStyle" value="0">
<param name="PathSeparator" value="/">
<param name="Sorted" value="0">
<param name="Style" value="7">
<param name="Checkboxes" value="0">
<param name="FullRowSelect" value="0">
<param name="HotTracking" value="0">
<param name="Scroll" value="1">
<param name="SingleSel" value="0">
<param name="ImageList" value>
<param name="BorderStyle" value="0">
<param name="Appearance" value="1">
<param name="MousePointer" value="0">
<param name="Enabled" value="1">
<param name="OLEDragMode" value="0">
<param name="OLEDropMode" value="0">
</object>
</p>
<p>
<object name="Treeview" classid="clsid:C74190B6-8589-11D1-B16A-00C0F0283628"
id="Tree002" width="242" height="159">
<param name="_ExtentX" value="6403">
<param name="_ExtentY" value="4207">
<param name="_Version" value="393217">
<param name="HideSelection" value="0">
<param name="Indentation" value="1000">
<param name="LabelEdit" value="0">
<param name="LineStyle" value="0">
<param name="PathSeparator" value="/">
<param name="Sorted" value="0">
<param name="Style" value="7">
<param name="Checkboxes" value="0">
<param name="FullRowSelect" value="0">
<param name="HotTracking" value="0">
<param name="Scroll" value="1">
<param name="SingleSel" value="0">
<param name="ImageList" value>
<param name="BorderStyle" value="0">
<param name="Appearance" value="1">
<param name="MousePointer" value="0">
<param name="Enabled" value="1">
<param name="OLEDragMode" value="0">
<param name="OLEDropMode" value="0">
</object>
</p>
</form>
<input type=hidden name="submitter" value=0>
<p>Browse a VFP table</p>
<table>
<TR><TD>Locate DBC</TD><TD><input type='file' size='80' name='DBCLOCATION'></TD></TR>
<TR><TD>TableName</TD><TD><input type='text' size='80' name='TABLENAME'></TD></TR>
</TABLE><HR>
<input type='button' value='List' onClick="CheckTable(DBCLOCATION.value,TABLENAME.value);return;">
<div id='tablelist'></div>
</body>
</html>
ENDTEXT
Return myVar
Define Class htmlSample As Form
Top = 0
Left = 0
Height = 600
Width = 800
DoCreate = .T.
Caption = "HTML sample"
cHTML = "<html><body></body></html>"
cHTMFile = ''
DoNotErase = .T.
Add Object htmlviewer As OleControl With ;
Top = 0, ;
Left = 0, ;
Height = 600, ;
Width = 800, ;
Visible = .T., ;
Name = "HTMLViewer", ;
OleClass = 'Shell.Explorer'
Procedure Destroy
If !This.DoNotErase And !Empty(This.cHTMFile) And File(This.cHTMFile)
Erase (This.cHTMFile)
Endif
Endproc
Procedure Init
Lparameters tcHTML, tlIsFile
If m.tlIsFile And !Empty(m.tcHTML) And File(m.tcHTML)
This.cHTMFile = m.tcHTML
This.DoNotErase = .T.
With Thisform.htmlviewer
.Navigate2('file://'+This.cHTMFile)
Do While .ReadyState # 4 && Wait for ready state
Enddo
Endwith
Else
If !Empty(m.tcHTML)
This.cHTMFile = Forcepath(Sys(2015)+'.htm',Sys(2023))
This.DoNotErase = .F.
Strtofile(m.tcHTML, This.cHTMFile)
With Thisform.htmlviewer
.Navigate2('file://'+This.cHTMFile)
Do While .ReadyState # 4 && Wait for ready state
Enddo
Endwith
Else
With This.htmlviewer
.Navigate2("about:blank")
.Document.Write(This.cHTML)
Endwith
Endif
Endif
Endproc
Procedure htmlviewer.NavigateError
Lparameters pdisp, url, frame, statuscode, Cancel
TEXT to m.lcParamList textmerge noshow
pdisp = pdisp
url = <<url>>
frame = <<frame>>
statuscode = <<statuscode>>
Cancel = <<Cancel>>
ENDTEXT
Messagebox(m.lcParamList)
Cancel = .T.
Endproc
Procedure htmlviewer.BeforeNavigate2
Lparameters pdisp, url, Flags, targetframename, postdata, headers, Cancel
TEXT to m.lcParamList textmerge noshow
pdisp = pdisp
url = <<url>>
flags = <<flags>>
targetframename = <<targetframename>>
postdata = <<postdata>>
headers = <<headers>>
Cancel = <<Cancel>>
ENDTEXT
Messagebox(m.lcParamList)
* oFrm = This.Object.Document.myForm
lcVals = ""
If This.Object.Document.Forms.Length > 0
For Each oFrm In This.Object.Document.Forms
lcVals = lcVals + oFrm.Name + Chr(13)
If oFrm.elements.Length > 0
For Each oElem In oFrm.elements
If oElem.Name = "Treeview"
lcVals = lcVals + "Name :" + oElem.Name + '::'+ oElem.Id + '::'+ "/Value:"+;
Iif(!Isnull(oElem.SelectedItem),;
oElem.SelectedItem.Key,"NULL") + Chr(13)
Else
If oElem.Type = "select-multiple"
lcList=''
For ix=0 To oElem.Length-1
If oElem.Item(ix).Selected
lcList = lcList + Iif(Empty(lcList),'',',')+oElem.Item(ix).Value
Endif
Endfor
lcVals = lcVals + "Name :" + oElem.Name + '::'+ oElem.Id + '::'+ "/Value:"+lcList + Chr(13)
Else
lcVals = lcVals + "Name :" + oElem.Name + '::'+ oElem.Id + '::'+ "/Value:"+oElem.Value + Chr(13)
Endif
Endif
oElem = .Null.
Endfor
Endif
oFrm = .Null.
Endfor
Endif
Cancel = .T. && prevents actual navigation
lcVals = lcVals + Chr(13)+Chr(10)+;
'Submitted by:'+Transform(This.Object.Document.All("submitter").Value)
Messagebox(lcVals)
Endproc
Procedure htmlviewer.Refresh
Nodefault
Endproc
Enddefine |