HTML Control Example

An example of using a HTML control is below. The example is a single HTML control on a form. The example just displays the simple use of each of controls methods.

$COMPLIANCE 3
DEFSUB 'Navigate(OBJECT oCtrl, sURL$)
oCtrl.Navigate(sURL$)
END SUB
- DEFFORM Form1()={.form,.form$,.Width=527,.Hei\
ght=329,.Style=0x50c000c4,.Text$="HTML Control",\
.Id=1024,.Enter()#},{.ok,.button$,.Left=473,.Top\
=30,.Width=50,.Height=14,.Style=0x50010001,.Text\
$="OK",.__Anchor=5,.Id=1},{.htmlControl1,.Html$,\
.Left=7,.Top=30,.Width=459,.Height=285,.Style=0x\
50000007,.Text$="Frame",.Id=1000,.BeforeNavigate\
()#,.NavigateComplete()#},{.buttonGoto,.button$,\
.Left=299,.Top=7,.Width=50,.Height=14,.Style=0x5\
0010001,.Text$="Goto",.Id=1003,.Click()#},{.butt\
onStop,.button$,.Left=357,.Top=6,.Width=50,.Heig\
ht=14,.Style=0x50010000,.Text$="Stop",.Id=1004,.\
Click()#},{.editURL,.kcmldbedit$,.Left=7,.Top=7,\
.Width=281,.Height=13,.Style=0x50810080,.Id=1005\
,.Text$="http://www.kcml.com"},{.buttonWrite,.bu\
tton$,.Left=415,.Top=6,.Width=50,.Height=14,.Sty\
le=0x50010000,.Text$="Write",.Id=1002,.Click()#}\
,{.pane1,.status$,.Width=100,.Style=0x50000000}
DEFEVENT Form1.Enter()
'Navigate(OBJECT Form1.htmlControl1, Form1.edit\
URL.Text$)
END EVENT
DEFEVENT Form1.htmlControl1.BeforeNavigate()
Form1.pane1.Text$ = $PRINTF("BeforeNavigate %s"\
, Form1.htmlControl1.EventURL$)
END EVENT
DEFEVENT Form1.htmlControl1.NavigateComplete()
Form1.pane1.Text$ = $PRINTF("NavigateComplete %\
s", Form1.htmlControl1.EventURL$)
END EVENT
DEFEVENT Form1.htmlControl1.DocumentComplete()
Form1.pane1.Text$ = $PRINTF("DocumentComplete %\
s", Form1.htmlControl1.EventURL$)
END EVENT
DEFEVENT Form1.buttonGoto.Click()
'Navigate(OBJECT Form1.htmlControl1, Form1.edit\
URL.Text$)
END EVENT
DEFEVENT Form1.buttonStop.Click()
// Stop navigation
Form1.htmlControl1.Stop()
END EVENT
DEFEVENT Form1.buttonWrite.Click()
Form1.htmlControl1.Write("<html><body><h1>hello\
 world</h1>" & "<a href='http://www.kcml.com'>kc\
ml.com</a><br/>" & "<a href='hiddenlink/a/b.d'>s\
pecial</a>" & "</body></html>")
END EVENT
FORM END
Form1.Open()