updated ipro example

git-svn-id: trunk@8303 -
This commit is contained in:
jesus 2005-12-13 07:08:20 +00:00
parent 7bc37435e5
commit ecff79f1e2
5 changed files with 104 additions and 33 deletions

View File

@ -4,7 +4,7 @@ object MainForm: TMainForm
ClientHeight = 327
ClientWidth = 569
OnCreate = MainFormCreate
PixelsPerInch = 75
PixelsPerInch = 96
HorzScrollBar.Page = 568
VertScrollBar.Page = 326
Left = 105
@ -14,6 +14,7 @@ object MainForm: TMainForm
object IpHtmlPanel1: TIpHtmlPanel
Align = alClient
FixedTypeface = 'Courier New'
DefaultTypeFace = 'default'
PrintSettings.MarginLeft = 0.5
PrintSettings.MarginTop = 0.5
PrintSettings.MarginRight = 0.5
@ -40,6 +41,16 @@ object MainForm: TMainForm
Top = 8
Width = 152
end
object Button1: TButton
BorderSpacing.InnerBorder = 2
Caption = 'Preview'
OnClick = Button1Click
TabOrder = 1
Left = 183
Height = 25
Top = 8
Width = 75
end
end
object OpenDialog1: TOpenDialog
Title = 'Open existing file'

View File

@ -4,19 +4,22 @@ LazarusResources.Add('TMainForm','FORMDATA',[
'TPF0'#9'TMainForm'#8'MainForm'#13'ActiveControl'#7#19'OpenHTMLFileButton1'#7
+'Caption'#6'0Example for turbopower internet pro HTML control'#12'ClientHeig'
+'ht'#3'G'#1#11'ClientWidth'#3'9'#2#8'OnCreate'#7#14'MainFormCreate'#13'Pixel'
+'sPerInch'#2'K'#18'HorzScrollBar.Page'#3'8'#2#18'VertScrollBar.Page'#3'F'#1#4
+'sPerInch'#2'`'#18'HorzScrollBar.Page'#3'8'#2#18'VertScrollBar.Page'#3'F'#1#4
+'Left'#2'i'#6'Height'#3'G'#1#3'Top'#2'm'#5'Width'#3'9'#2#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#29#1#3'Top'#2'*'#5'Wi'
+'dth'#3'9'#2#0#0#6'TPanel'#6'Panel1'#5'Align'#7#5'alTop'#12'ClientHeight'#2
+'*'#11'ClientWidth'#3'9'#2#8'TabOrder'#2#0#6'Height'#2'*'#5'Width'#3'9'#2#0#7
+'TButton'#19'OpenHTMLFileButton1'#25'BorderSpacing.InnerBorder'#2#2#7'Captio'
+'n'#6#14'Open HTML File'#7'OnClick'#7#23'OpenHTMLFileButtonClick'#8'TabOrder'
+#2#0#4'Left'#2#16#6'Height'#2#26#3'Top'#2#8#5'Width'#3#152#0#0#0#0#11'TOpenD'
+'ialog'#11'OpenDialog1'#5'Title'#6#18'Open existing file'#6'Filter'#6#22'Web'
+' Pages|*.html;*.htm'#11'FilterIndex'#2#0#5'Title'#6#18'Open existing file'#4
+'left'#2#26#3'top'#2']'#0#0#0
+#15'DefaultTypeFace'#6#7'default'#24'PrintSettings.MarginLeft'#5#0#0#0#0#0#0
+#0#128#254'?'#23'PrintSettings.MarginTop'#5#0#0#0#0#0#0#0#128#254'?'#25'Prin'
+'tSettings.MarginRight'#5#0#0#0#0#0#0#0#128#254'?'#26'PrintSettings.MarginBo'
+'ttom'#5#0#0#0#0#0#0#0#128#254'?'#10'OnHotClick'#7#20'IpHtmlPanel1HotClick'#6
+'Height'#3#29#1#3'Top'#2'*'#5'Width'#3'9'#2#0#0#6'TPanel'#6'Panel1'#5'Align'
+#7#5'alTop'#12'ClientHeight'#2'*'#11'ClientWidth'#3'9'#2#8'TabOrder'#2#0#6'H'
+'eight'#2'*'#5'Width'#3'9'#2#0#7'TButton'#19'OpenHTMLFileButton1'#25'BorderS'
+'pacing.InnerBorder'#2#2#7'Caption'#6#14'Open HTML File'#7'OnClick'#7#23'Ope'
+'nHTMLFileButtonClick'#8'TabOrder'#2#0#4'Left'#2#16#6'Height'#2#26#3'Top'#2#8
+#5'Width'#3#152#0#0#0#7'TButton'#7'Button1'#25'BorderSpacing.InnerBorder'#2#2
+#7'Caption'#6#7'Preview'#7'OnClick'#7#12'Button1Click'#8'TabOrder'#2#1#4'Lef'
+'t'#3#183#0#6'Height'#2#25#3'Top'#2#8#5'Width'#2'K'#0#0#0#11'TOpenDialog'#11
+'OpenDialog1'#5'Title'#6#18'Open existing file'#6'Filter'#6#22'Web Pages|*.h'
+'tml;*.htm'#11'FilterIndex'#2#0#5'Title'#6#18'Open existing file'#4'left'#2
+#26#3'top'#2']'#0#0#0
]);

View File

@ -2,11 +2,19 @@ unit MainUnit;
{$mode objfpc}{$H+}
{.$define UsePreview}
{.$define UseJPEG}
interface
uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, Buttons,
//LazJpeg,
{$ifdef UseJPEG}
LazJpeg,
{$endif}
{$ifdef UsePreview}
OsPrinters,
{$endif}
IpHtml, ExtCtrls, StdCtrls;
type
@ -20,10 +28,12 @@ type
{ TMainForm }
TMainForm = class(TForm)
Button1: TButton;
IpHtmlPanel1: TIpHtmlPanel;
OpenDialog1: TOpenDialog;
OpenHTMLFileButton1: TButton;
Panel1: TPanel;
procedure Button1Click(Sender: TObject);
procedure HTMLGetImageX(Sender: TIpHtmlNode; const URL: string;
var Picture: TPicture);
procedure IpHtmlPanel1HotClick(Sender: TObject);
@ -85,6 +95,18 @@ begin
end;
end;
procedure TMainForm.Button1Click(Sender: TObject);
begin
{$ifdef UsePreview}
IpHtmlPanel1.PrintPreview;
{$else}
ShowMessage(
'In order to use this feature, please read instructions'#13+
'contained in the readme file included in this project'#13+
'directory');
{$endif}
end;
procedure TMainForm.OpenHTMLFile(const Filename: string);
var
fs: TFileStream;

View File

@ -8,19 +8,31 @@ this test follow this steps:
2. [OPTIONAL RECOMMENDED] To add jpeg picture format support,
Install package JpegForLazarus.lpk
located in directory $LazarusDir/components/jpeg.
3. [OPTIONAL] To add print preview support to project sample
install package Printer4Lazarus.lpk
located in directory $LazarusDir/components/printers
3. Open test project tpiproexample.lpi
4. Open test project tpiproexample.lpi
4. [OPTIONAL] if step 2 is done:
5. [OPTIONAL] if step 2 is done then do:
4a. Add JpegForLazarus package requeriment to the sample
5a. Add JpegForLazarus package requeriment to the sample
[menu]->Project->Project Inspector->Add->New Requirement
and then select "JPEGForLazarus" from the Package name list.
5b. Enable this feature by editing compiler define at top of main
unit from {.$define UseJPEG} to {$define UseJPEG}.
6. [OPTIONAL] if step 2 is done then do:
and then select from the Package name list JPEGForLazarus
4b. Uncomment the line LazJpeg, in the uses clause of the
main unit
6a. Add Printer4Lazarus package requeriment to the sample
[menu]->Project->Project Inspector->Add->New Requirement
and then select "Printer4Lazarus" from the Package name list.
6b. Enable this feature by editing compiler define at top of main
unit from {.$define UsePreview} to {$define UsePreview}.
5. Run
7. Run

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<PathDelim Value="/"/>
<PathDelim Value="\"/>
<Version Value="5"/>
<General>
<Flags>
@ -16,15 +16,15 @@
<LazDoc Paths=""/>
<Units Count="3">
<Unit0>
<CursorPos X="22" Y="6"/>
<CursorPos X="13" Y="6"/>
<Filename Value="tpiproexample.lpr"/>
<IsPartOfProject Value="True"/>
<TopLine Value="1"/>
<UnitName Value="TPIProExample"/>
<UsageCount Value="63"/>
<UsageCount Value="72"/>
</Unit0>
<Unit1>
<CursorPos X="14" Y="4"/>
<CursorPos X="22" Y="11"/>
<EditorIndex Value="0"/>
<Filename Value="mainunit.pas"/>
<ComponentName Value="MainForm"/>
@ -33,7 +33,7 @@
<ResourceFilename Value="mainunit.lrs"/>
<TopLine Value="1"/>
<UnitName Value="MainUnit"/>
<UsageCount Value="63"/>
<UsageCount Value="72"/>
</Unit1>
<Unit2>
<CursorPos X="1" Y="1"/>
@ -41,11 +41,12 @@
<IsPartOfProject Value="True"/>
<SyntaxHighlighter Value="HTML"/>
<TopLine Value="1"/>
<UsageCount Value="63"/>
<UsageCount Value="72"/>
</Unit2>
</Units>
<PublishOptions>
<Version Value="2"/>
<DestinationDirectory Value="$(TestDir)\publishedproject\"/>
<IgnoreBinaries Value="False"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
@ -53,7 +54,7 @@
<RunParams>
<local>
<FormatVersion Value="1"/>
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
<LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<RequiredPackages Count="2">
@ -66,13 +67,35 @@
<MinVersion Major="1" Valid="True"/>
</Item2>
</RequiredPackages>
<JumpHistory Count="0" HistoryIndex="-1"/>
<JumpHistory Count="5" HistoryIndex="4">
<Position1>
<Filename Value="mainunit.pas"/>
<Caret Line="84" Column="30" TopLine="80"/>
</Position1>
<Position2>
<Filename Value="mainunit.pas"/>
<Caret Line="92" Column="1" TopLine="90"/>
</Position2>
<Position3>
<Filename Value="mainunit.pas"/>
<Caret Line="9" Column="16" TopLine="1"/>
</Position3>
<Position4>
<Filename Value="mainunit.pas"/>
<Caret Line="1" Column="11" TopLine="1"/>
</Position4>
<Position5>
<Filename Value="mainunit.pas"/>
<Caret Line="101" Column="20" TopLine="91"/>
</Position5>
</JumpHistory>
</ProjectOptions>
<CompilerOptions>
<Version Value="5"/>
<PathDelim Value="\"/>
<SearchPaths>
<OtherUnitFiles Value="$(LazarusDir)/components/units/$(TargetCPU)/$(TargetOS)/"/>
<SrcPath Value="$(LazarusDir)/lcl/;$(LazarusDir)/lcl/interfaces/$(LCLWidgetType)/"/>
<OtherUnitFiles Value="$(LazarusDir)\components\units\$(TargetCPU)\$(TargetOS)\"/>
<SrcPath Value="$(LazarusDir)\lcl\;$(LazarusDir)\lcl\interfaces\$(LCLWidgetType)\"/>
</SearchPaths>
<CodeGeneration>
<Generate Value="Faster"/>