mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-10 02:28:04 +02:00
added example for ipro component
git-svn-id: trunk@5507 -
This commit is contained in:
parent
c973629965
commit
6b21bbd682
7
.gitattributes
vendored
7
.gitattributes
vendored
@ -403,6 +403,13 @@ examples/treeview/tv_add_remove.lpi svneol=native#text/plain
|
||||
examples/treeview/tv_add_remove_u1.lfm svneol=native#text/plain
|
||||
examples/treeview/tv_add_remove_u1.lrs svneol=native#text/pascal
|
||||
examples/treeview/tv_add_remove_u1.pas svneol=native#text/pascal
|
||||
examples/turbopower_ipro/index.html svneol=native#text/html
|
||||
examples/turbopower_ipro/mainunit.lfm svneol=native#text/plain
|
||||
examples/turbopower_ipro/mainunit.lrs svneol=native#text/pascal
|
||||
examples/turbopower_ipro/mainunit.pas svneol=native#text/pascal
|
||||
examples/turbopower_ipro/simplepage2.html svneol=native#text/html
|
||||
examples/turbopower_ipro/tpiproexample.lpi svneol=native#text/plain
|
||||
examples/turbopower_ipro/tpiproexample.lpr svneol=native#text/pascal
|
||||
ide/aboutfrm.lfm svneol=native#text/plain
|
||||
ide/aboutfrm.lrs svneol=native#text/pascal
|
||||
ide/aboutfrm.pas svneol=native#text/pascal
|
||||
|
16
examples/turbopower_ipro/index.html
Normal file
16
examples/turbopower_ipro/index.html
Normal file
@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type"
|
||||
content="text/html; charset=ISO-8859-1">
|
||||
<title>Test Page for IPro HTML control for Lazarus</title>
|
||||
</head>
|
||||
<body>
|
||||
Lazarus example for IPro HTML control.<br>
|
||||
<br>
|
||||
<img src="../../images/lazarus.bmp" title="" alt="Lazarus image"
|
||||
style="width: 250px; height: 188px;"><br>
|
||||
<br>
|
||||
<a href="simplepage2.html">Link</a><br>
|
||||
</body>
|
||||
</html>
|
31
examples/turbopower_ipro/mainunit.lfm
Normal file
31
examples/turbopower_ipro/mainunit.lfm
Normal file
@ -0,0 +1,31 @@
|
||||
object MainForm: TMainForm
|
||||
Caption = 'Example for turbopower internet pro HTML control'
|
||||
ClientHeight = 327
|
||||
ClientWidth = 569
|
||||
OnCreate = MainFormCreate
|
||||
HorzScrollBar.Page = 570
|
||||
VertScrollBar.Page = 328
|
||||
Left = 291
|
||||
Height = 327
|
||||
Top = 163
|
||||
Width = 569
|
||||
object OpenHTMLFileButton: TButton
|
||||
Align = alTop
|
||||
Caption = 'Open HTML File'
|
||||
TabOrder = 0
|
||||
Height = 25
|
||||
Width = 569
|
||||
end
|
||||
object IpHtmlPanel1: TIpHtmlPanel
|
||||
Align = alClient
|
||||
FixedTypeface = 'Courier New'
|
||||
PrintSettings.MarginLeft = 0.5
|
||||
PrintSettings.MarginTop = 0.5
|
||||
PrintSettings.MarginRight = 0.5
|
||||
PrintSettings.MarginBottom = 0.5
|
||||
OnHotClick = IpHtmlPanel1HotClick
|
||||
Height = 302
|
||||
Top = 25
|
||||
Width = 569
|
||||
end
|
||||
end
|
16
examples/turbopower_ipro/mainunit.lrs
Normal file
16
examples/turbopower_ipro/mainunit.lrs
Normal file
@ -0,0 +1,16 @@
|
||||
{ This is an automatically generated lazarus resource file }
|
||||
|
||||
LazarusResources.Add('TMainForm','FORMDATA',[
|
||||
'TPF0'#9'TMainForm'#8'MainForm'#7'Caption'#6'0Example for turbopower internet'
|
||||
+' pro HTML control'#12'ClientHeight'#3'G'#1#11'ClientWidth'#3'9'#2#8'OnCreat'
|
||||
+'e'#7#14'MainFormCreate'#18'HorzScrollBar.Page'#3':'#2#18'VertScrollBar.Page'
|
||||
+#3'H'#1#4'Left'#3'#'#1#6'Height'#3'G'#1#3'Top'#3#163#0#5'Width'#3'9'#2#0#7'T'
|
||||
+'Button'#18'OpenHTMLFileButton'#5'Align'#7#5'alTop'#7'Caption'#6#14'Open HTM'
|
||||
+'L File'#8'TabOrder'#2#0#6'Height'#2#25#5'Width'#3'9'#2#0#0#12'TIpHtmlPanel'
|
||||
+#12'IpHtmlPanel1'#5'Align'#7#8'alClient'#13'FixedTypeface'#6#11'Courier New'
|
||||
+#24'PrintSettings.MarginLeft'#5#0#0#0#0#0#0#0#128#254'?'#23'PrintSettings.Ma'
|
||||
+'rginTop'#5#0#0#0#0#0#0#0#128#254'?'#25'PrintSettings.MarginRight'#5#0#0#0#0
|
||||
+#0#0#0#128#254'?'#26'PrintSettings.MarginBottom'#5#0#0#0#0#0#0#0#128#254'?'
|
||||
+#10'OnHotClick'#7#20'IpHtmlPanel1HotClick'#6'Height'#3'.'#1#3'Top'#2#25#5'Wi'
|
||||
+'dth'#3'9'#2#0#0#0
|
||||
]);
|
98
examples/turbopower_ipro/mainunit.pas
Normal file
98
examples/turbopower_ipro/mainunit.pas
Normal file
@ -0,0 +1,98 @@
|
||||
unit MainUnit;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, Buttons,
|
||||
IpHtml;
|
||||
|
||||
type
|
||||
TSimpleIpHtml = class(TIpHtml)
|
||||
public
|
||||
property OnGetImageX;
|
||||
end;
|
||||
// TIpSimpleHtmlDataProvider = class(TIpAbstractHtmlDataProvider)
|
||||
// end;
|
||||
|
||||
TMainForm = class(TForm)
|
||||
IpHtmlPanel1: TIpHtmlPanel;
|
||||
OpenHTMLFileButton: TButton;
|
||||
procedure HTMLGetImageX(Sender: TIpHtmlNode; const URL: string;
|
||||
var Picture: TPicture);
|
||||
procedure IpHtmlPanel1HotClick(Sender: TObject);
|
||||
procedure MainFormCreate(Sender: TObject);
|
||||
public
|
||||
procedure OpenHTMLFile(const Filename: string);
|
||||
end;
|
||||
|
||||
var
|
||||
MainForm: TMainForm;
|
||||
|
||||
implementation
|
||||
|
||||
{ TMainForm }
|
||||
|
||||
procedure TMainForm.MainFormCreate(Sender: TObject);
|
||||
begin
|
||||
OpenHTMLFile('index.html');
|
||||
end;
|
||||
|
||||
procedure TMainForm.IpHtmlPanel1HotClick(Sender: TObject);
|
||||
var
|
||||
NodeA: TIpHtmlNodeA;
|
||||
NewFilename: String;
|
||||
begin
|
||||
if IpHtmlPanel1.HotNode is TIpHtmlNodeA then begin
|
||||
NodeA:=TIpHtmlNodeA(IpHtmlPanel1.HotNode);
|
||||
NewFilename:=NodeA.HRef;
|
||||
OpenHTMLFile(NewFilename);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainForm.HTMLGetImageX(Sender: TIpHtmlNode; const URL: string;
|
||||
var Picture: TPicture);
|
||||
begin
|
||||
try
|
||||
if Picture=nil then
|
||||
Picture:=TPicture.Create;
|
||||
Picture.LoadFromFile(URL);
|
||||
except
|
||||
on E: Exception do begin
|
||||
MessageDlg('Unable to open image file',
|
||||
'Image file: '+URL+#13
|
||||
+'Error: '+E.Message,mtError,[mbCancel],0);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainForm.OpenHTMLFile(const Filename: string);
|
||||
var
|
||||
fs: TFileStream;
|
||||
NewHTML: TSimpleIpHtml;
|
||||
begin
|
||||
try
|
||||
fs:=TFileStream.Create(Filename,fmOpenRead);
|
||||
try
|
||||
NewHTML:=TSimpleIpHtml.Create; // Beware: Will be freed automatically by IpHtmlPanel1
|
||||
NewHTML.OnGetImageX:=@HTMLGetImageX;
|
||||
NewHTML.LoadFromStream(fs);
|
||||
finally
|
||||
fs.Free;
|
||||
end;
|
||||
IpHtmlPanel1.SetHtml(NewHTML);
|
||||
except
|
||||
on E: Exception do begin
|
||||
MessageDlg('Unable to open HTML file',
|
||||
'HTML File: '+Filename+#13
|
||||
+'Error: '+E.Message,mtError,[mbCancel],0);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
initialization
|
||||
{$I mainunit.lrs}
|
||||
|
||||
end.
|
||||
|
11
examples/turbopower_ipro/simplepage2.html
Normal file
11
examples/turbopower_ipro/simplepage2.html
Normal file
@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type"
|
||||
content="text/html; charset=ISO-8859-1">
|
||||
<title>Simple Page 2</title>
|
||||
</head>
|
||||
<body>
|
||||
Go <a href="index.html">back</a>.<br>
|
||||
</body>
|
||||
</html>
|
83
examples/turbopower_ipro/tpiproexample.lpi
Normal file
83
examples/turbopower_ipro/tpiproexample.lpi
Normal file
@ -0,0 +1,83 @@
|
||||
<?xml version="1.0"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="3"/>
|
||||
<General>
|
||||
<ProjectType Value="Application"/>
|
||||
<Flags>
|
||||
<SaveClosedFiles Value="False"/>
|
||||
<SaveOnlyProjectUnits Value="True"/>
|
||||
</Flags>
|
||||
<MainUnit Value="0"/>
|
||||
<ActiveEditorIndexAtStart Value="0"/>
|
||||
<IconPath Value="./"/>
|
||||
<TargetFileExt Value=""/>
|
||||
<Title Value="tpiproexample"/>
|
||||
</General>
|
||||
<Units Count="3">
|
||||
<Unit0>
|
||||
<CursorPos X="5" Y="6"/>
|
||||
<Filename Value="tpiproexample.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<TopLine Value="1"/>
|
||||
<UnitName Value="TPIProExample"/>
|
||||
<UsageCount Value="25"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<CursorPos X="15" Y="81"/>
|
||||
<EditorIndex Value="0"/>
|
||||
<Filename Value="mainunit.pas"/>
|
||||
<ComponentName Value="MainForm"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<Loaded Value="True"/>
|
||||
<ResourceFilename Value="mainunit.lrs"/>
|
||||
<TopLine Value="54"/>
|
||||
<UnitName Value="MainUnit"/>
|
||||
<UsageCount Value="25"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
<CursorPos X="1" Y="1"/>
|
||||
<Filename Value="index.html"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<SyntaxHighlighter Value="HTML"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="25"/>
|
||||
</Unit2>
|
||||
</Units>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<IgnoreBinaries Value="False"/>
|
||||
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
||||
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="2">
|
||||
<Item1>
|
||||
<PackageName Value="TurboPowerIPro"/>
|
||||
<MinVersion Major="1" Valid="True"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="LCL"/>
|
||||
<MinVersion Major="1" Valid="True"/>
|
||||
</Item2>
|
||||
</RequiredPackages>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="2"/>
|
||||
<SearchPaths>
|
||||
<OtherUnitFiles Value="$(LazarusDir)/components/units/$(TargetCPU)/$(TargetOS)/"/>
|
||||
<SrcPath Value="$(LazarusDir)/lcl/;$(LazarusDir)/lcl/interfaces/$(LCLWidgetType)/"/>
|
||||
</SearchPaths>
|
||||
<CodeGeneration>
|
||||
<Generate Value="Faster"/>
|
||||
</CodeGeneration>
|
||||
<Other>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
</CONFIG>
|
15
examples/turbopower_ipro/tpiproexample.lpr
Normal file
15
examples/turbopower_ipro/tpiproexample.lpr
Normal file
@ -0,0 +1,15 @@
|
||||
program TPIProExample;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
//MemCheck,
|
||||
Interfaces,
|
||||
Forms, MainUnit;
|
||||
|
||||
begin
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TMainForm, MainForm);
|
||||
Application.Run;
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user