Difference between revisions of "TIpHtmlPanel"
From Free Pascal wiki
Jump to navigationJump to searchLine 4: | Line 4: | ||
<syntaxhighlight> | <syntaxhighlight> | ||
− | + | procedure TMainForm.ShowText( const txt: string ); | |
− | pHTML:= | + | var |
− | + | fs: TStringStream; | |
− | + | pHTML: TIpHtml; | |
− | + | begin | |
+ | try | ||
+ | fs := TStringStream.Create( txt ); | ||
+ | try | ||
+ | pHTML:=TIpHtml.Create; // Beware: Will be freed automatically by IpHtmlPanel1 | ||
+ | pHTML.LoadFromStream(fs); | ||
+ | finally | ||
+ | fs.Free; | ||
+ | end; | ||
+ | IpHtmlPanel1.SetHtml( pHTML ); | ||
+ | except | ||
+ | on E: Exception do begin | ||
+ | MessageDlg( 'Error: '+E.Message, mtError, [mbCancel], 0 ); | ||
+ | end; | ||
+ | end; | ||
+ | end; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
== See also == | == See also == |
Revision as of 10:58, 26 August 2016
The TIpHtmlPanel component is the display part of the Turbopower Internet Pro package that delivers native HTML-access. The component is available from the IPro tab of the Component Palette.
A TIpHtmlPanel gets its contents from a TIpHTML descendant:
procedure TMainForm.ShowText( const txt: string );
var
fs: TStringStream;
pHTML: TIpHtml;
begin
try
fs := TStringStream.Create( txt );
try
pHTML:=TIpHtml.Create; // Beware: Will be freed automatically by IpHtmlPanel1
pHTML.LoadFromStream(fs);
finally
fs.Free;
end;
IpHtmlPanel1.SetHtml( pHTML );
except
on E: Exception do begin
MessageDlg( 'Error: '+E.Message, mtError, [mbCancel], 0 );
end;
end;
end;
See also