examples: update component streaming example

git-svn-id: trunk@25055 -
This commit is contained in:
paul 2010-04-29 02:06:59 +00:00
parent d28be234d9
commit 9fde93411b
4 changed files with 59 additions and 61 deletions

View File

@ -1,14 +1,19 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<CONFIG> <CONFIG>
<ProjectOptions> <ProjectOptions>
<PathDelim Value="/"/> <Version Value="7"/>
<Version Value="5"/>
<General> <General>
<Flags>
<LRSInOutputDirectory Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/> <SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/> <MainUnit Value="0"/>
<IconPath Value="./"/>
<TargetFileExt Value=""/> <TargetFileExt Value=""/>
<UseXPManifest Value="True"/>
</General> </General>
<VersionInfo>
<StringTable Comments="" CompanyName="" FileDescription="" FileVersion="0.0.0.0" InternalName="" LegalCopyright="" LegalTrademarks="" OriginalFilename="" ProductName="" ProductVersion="0.0.0.0"/>
</VersionInfo>
<PublishOptions> <PublishOptions>
<Version Value="2"/> <Version Value="2"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
@ -33,21 +38,18 @@
</Unit0> </Unit0>
<Unit1> <Unit1>
<Filename Value="mainunit.pas"/> <Filename Value="mainunit.pas"/>
<ComponentName Value="CompStreamDemoForm"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ResourceFilename Value="mainunit.lrs"/> <ComponentName Value="CompStreamDemoForm"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="MainUnit"/> <UnitName Value="MainUnit"/>
</Unit1> </Unit1>
</Units> </Units>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>
<Version Value="5"/> <Version Value="8"/>
<SearchPaths> <SearchPaths>
<SrcPath Value="$(LazarusDir)/lcl/;$(LazarusDir)/lcl/interfaces/$(LCLWidgetType)/"/> <SrcPath Value="$(LazarusDir)/lcl/;$(LazarusDir)/lcl/interfaces/$(LCLWidgetType)/"/>
</SearchPaths> </SearchPaths>
<CodeGeneration>
<Generate Value="Faster"/>
</CodeGeneration>
<Linking> <Linking>
<Options> <Options>
<Win32> <Win32>

View File

@ -10,6 +10,8 @@ uses
Forms Forms
{ add your units here }, MainUnit; { add your units here }, MainUnit;
{$R *.res}
begin begin
Application.Initialize; Application.Initialize;
Application.CreateForm(TCompStreamDemoForm, CompStreamDemoForm); Application.CreateForm(TCompStreamDemoForm, CompStreamDemoForm);

View File

@ -1,115 +1,110 @@
object CompStreamDemoForm: TCompStreamDemoForm object CompStreamDemoForm: TCompStreamDemoForm
Caption = 'Streaming components example'
ClientHeight = 485
ClientWidth = 525
OnCreate = FormCreate
PixelsPerInch = 112
HorzScrollBar.Page = 524
VertScrollBar.Page = 484
Left = 292 Left = 292
Height = 485 Height = 485
Top = 168 Top = 168
Width = 525 Width = 525
HorzScrollBar.Page = 524
VertScrollBar.Page = 484
Caption = 'Streaming components example'
ClientHeight = 485
ClientWidth = 525
OnCreate = FormCreate
LCLVersion = '0.9.29'
object Note1Label: TLabel object Note1Label: TLabel
Left = 253
Height = 16
Top = 27
Width = 463
Caption = 'This example demonstrates, how to stream a component to a stream in binary format ...' Caption = 'This example demonstrates, how to stream a component to a stream in binary format ...'
Color = clNone
ParentColor = False ParentColor = False
WordWrap = True WordWrap = True
Left = 253
Height = 133
Top = 27
Width = 217
end end
object Note2Label: TLabel object Note2Label: TLabel
Left = 265
Height = 16
Top = 325
Width = 1269
Caption = '... and how to reconstruct the component from a stream. This technique can be used to save components to disk or to transfer them via network. Of course this also works for your own classes as long as they are descendants of TComponent.' Caption = '... and how to reconstruct the component from a stream. This technique can be used to save components to disk or to transfer them via network. Of course this also works for your own classes as long as they are descendants of TComponent.'
Color = clNone
ParentColor = False ParentColor = False
WordWrap = True WordWrap = True
Left = 265
Height = 103
Top = 325
Width = 228
end end
object SourceGroupBox: TGroupBox object SourceGroupBox: TGroupBox
Caption = 'Source'
ClientHeight = 73
ClientWidth = 191
TabOrder = 0
Left = 15 Left = 15
Height = 90 Height = 90
Top = 25 Top = 25
Width = 195 Width = 195
Caption = 'Source'
ClientHeight = 72
ClientWidth = 191
TabOrder = 0
object AGroupBox: TGroupBox object AGroupBox: TGroupBox
Caption = 'AGroupBox'
ClientHeight = 26
ClientWidth = 124
TabOrder = 0
Left = 23 Left = 23
Height = 43 Height = 43
Top = 15 Top = 15
Width = 128 Width = 128
Caption = 'AGroupBox'
TabOrder = 0
end end
end end
object DestinationGroupBox: TGroupBox object DestinationGroupBox: TGroupBox
Anchors = [akLeft, akBottom]
Caption = 'Destination'
ClientHeight = 92
ClientWidth = 211
TabOrder = 1
Left = 30 Left = 30
Height = 109 Height = 109
Top = 360 Top = 360
Width = 215 Width = 215
Anchors = [akLeft, akBottom]
Caption = 'Destination'
TabOrder = 1
end end
object WriteToStreamButton: TButton object WriteToStreamButton: TButton
Caption = '1. Write AGroupBox to stream'
OnClick = WriteToStreamButtonClick
TabOrder = 2
Left = 23 Left = 23
Height = 25 Height = 25
Top = 130 Top = 130
Width = 197 Width = 197
Caption = '1. Write AGroupBox to stream'
OnClick = WriteToStreamButtonClick
TabOrder = 2
end end
object StreamGroupBox: TGroupBox object StreamGroupBox: TGroupBox
Anchors = [akTop, akLeft, akRight, akBottom]
Caption = 'Stream (special characters are shown as hexnumbers)'
ClientHeight = 115
ClientWidth = 492
TabOrder = 3
Left = 15 Left = 15
Height = 132 Height = 132
Top = 170 Top = 170
Width = 496 Width = 496
Anchors = [akTop, akLeft, akRight, akBottom]
Caption = 'Stream (special characters are shown as hexnumbers)'
ClientHeight = 114
ClientWidth = 492
TabOrder = 3
object StreamMemo: TMemo object StreamMemo: TMemo
Left = 0
Height = 95
Top = 0
Width = 492
Align = alClient Align = alClient
Lines.Strings = ( Lines.Strings = (
'First click on the button above, then on button below' 'First click on the button above, then on button below'
) )
ReadOnly = True ReadOnly = True
TabOrder = 0 TabOrder = 0
Height = 91
Width = 492
end end
object StreamAsLFMCheckBox: TCheckBox object StreamAsLFMCheckBox: TCheckBox
Left = 0
Height = 19
Top = 95
Width = 492
Align = alBottom Align = alBottom
Caption = 'Show sream in LFM format (text)' Caption = 'Show sream in LFM format (text)'
OnChange = StreamAsLFMCheckBoxChange OnChange = StreamAsLFMCheckBoxChange
TabOrder = 1 TabOrder = 1
Height = 24
Top = 91
Width = 492
end end
end end
object ReadStreamButton: TButton object ReadStreamButton: TButton
Anchors = [akLeft, akBottom]
Caption = '2. Create component from stream'
OnClick = ReadStreamButtonClick
TabOrder = 4
Left = 25 Left = 25
Height = 24 Height = 24
Top = 316 Top = 316
Width = 215 Width = 215
Anchors = [akLeft, akBottom]
Caption = '2. Create component from stream'
OnClick = ReadStreamButtonClick
TabOrder = 4
end end
end end

View File

@ -43,6 +43,8 @@ var
implementation implementation
{$R *.lfm}
{ TCompStreamDemoForm } { TCompStreamDemoForm }
procedure TCompStreamDemoForm.WriteToStreamButtonClick(Sender: TObject); procedure TCompStreamDemoForm.WriteToStreamButtonClick(Sender: TObject);
@ -169,8 +171,5 @@ begin
ComponentClass:=TCheckBox; ComponentClass:=TCheckBox;
end; end;
initialization
{$I mainunit.lrs}
end. end.