New example for IPro FindNode functions. Issue #29483, from Silvio Clécio.

git-svn-id: trunk@51432 -
This commit is contained in:
juha 2016-01-27 18:18:18 +00:00
parent 3da9248939
commit 380b2f5724
6 changed files with 212 additions and 0 deletions

5
.gitattributes vendored
View File

@ -4290,6 +4290,11 @@ components/turbopower_ipro/examples/htmlwithcssfrm.lfm svneol=native#text/plain
components/turbopower_ipro/examples/htmlwithcssfrm.pas svneol=native#text/plain
components/turbopower_ipro/examples/index.html svneol=native#text/plain
components/turbopower_ipro/examples/simplepage2.html svneol=native#text/plain
components/turbopower_ipro/examples/sum.html svneol=native#text/plain
components/turbopower_ipro/examples/sumab.lpi svneol=native#text/plain
components/turbopower_ipro/examples/sumab.lpr svneol=native#text/pascal
components/turbopower_ipro/examples/sumabfrm.lfm svneol=native#text/plain
components/turbopower_ipro/examples/sumabfrm.pas svneol=native#text/pascal
components/turbopower_ipro/for_delphi/ipHtml.dcr -text
components/turbopower_ipro/for_delphi/iphtml.res -text
components/turbopower_ipro/ipanim.pas svneol=native#text/pascal

View File

@ -0,0 +1,14 @@
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Sum</title>
</head>
<body>
<form method="post">
Value A: <input id="a" type="text" value="10" style="background-color: #ffff96;"/><br />
Value B: <input id="b" type="text" value="20" style="background-color: #ffff96;"/><br />
<input type="submit" value="Sum" />
</form>
</body>
</html>

View File

@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<PathDelim Value="\"/>
<General>
<Flags>
<SaveOnlyProjectUnits Value="True"/>
</Flags>
<MainUnit Value="0"/>
<Title Value="sumab"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<Icon Value="0"/>
</General>
<i18n>
<EnableI18N LFM="False"/>
</i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1" Active="Default">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
</RunParams>
<RequiredPackages Count="2">
<Item1>
<PackageName Value="TurboPowerIPro"/>
</Item1>
<Item2>
<PackageName Value="LCL"/>
</Item2>
</RequiredPackages>
<Units Count="2">
<Unit0>
<Filename Value="sumab.lpr"/>
<IsPartOfProject Value="True"/>
<UsageCount Value="20"/>
</Unit0>
<Unit1>
<Filename Value="sumabfrm.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<IsVisibleTab Value="True"/>
<UsageCount Value="20"/>
<Loaded Value="True"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="sumab"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@ -0,0 +1,19 @@
program sumab;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, Forms, sumabfrm;
{$R *.res}
begin
RequireDerivedFormResource := True;
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

View File

@ -0,0 +1,33 @@
object Form1: TForm1
Left = 237
Height = 240
Top = 144
Width = 320
Caption = 'Sum A+B'
ClientHeight = 240
ClientWidth = 320
OnShow = FormShow
LCLVersion = '1.7'
object IpHtmlPanel1: TIpHtmlPanel
Left = 0
Height = 240
Top = 0
Width = 320
Align = alClient
DataProvider = IpFileDataProvider1
FixedTypeface = 'Courier New'
DefaultTypeFace = 'default'
DefaultFontSize = 12
FlagErrors = False
PrintSettings.MarginLeft = 0.5
PrintSettings.MarginTop = 0.5
PrintSettings.MarginRight = 0.5
PrintSettings.MarginBottom = 0.5
TabOrder = 0
OnControlClick2 = IpHtmlPanel1ControlClick2
end
object IpFileDataProvider1: TIpFileDataProvider
left = 56
top = 23
end
end

View File

@ -0,0 +1,51 @@
unit sumabfrm;
{$mode objfpc}{$H+}
{$MODESWITCH NESTEDPROCVARS}
interface
uses
Classes, SysUtils, Ipfilebroker, IpHtml, Forms, Dialogs;
type
{ TForm1 }
TForm1 = class(TForm)
IpFileDataProvider1: TIpFileDataProvider;
IpHtmlPanel1: TIpHtmlPanel;
procedure FormShow(Sender: TObject);
procedure IpHtmlPanel1ControlClick2(Sender: TIpHtmlCustomPanel;
Frame: TIpHtmlFrame; Html: TIpHtml; Node: TIpHtmlNodeControl;
var cancel: boolean);
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.FormShow(Sender: TObject);
begin
IpHtmlPanel1.OpenURL(
ExpandLocalHtmlFileName(ExtractFilePath(ParamStr(0)) + 'sum.html'));
end;
procedure TForm1.IpHtmlPanel1ControlClick2(Sender: TIpHtmlCustomPanel;
Frame: TIpHtmlFrame; Html: TIpHtml; Node: TIpHtmlNodeControl;
var cancel: boolean);
var
A, B: TIpHtmlNodeINPUT;
begin
A := FindNodeByElemId(Html.HtmlNode, 'a') as TIpHtmlNodeINPUT;
B := FindNodeByElemId(Html.HtmlNode, 'b') as TIpHtmlNodeINPUT;
ShowMessageFmt('Sum: %d', [A.Value.ToInteger + B.Value.ToInteger]);
end;
end.