Skip to content

Commit

Permalink
UniqueInstance: update test component demo
Browse files Browse the repository at this point in the history
  • Loading branch information
blikblum committed Jan 11, 2017
1 parent 407f381 commit 49ea703
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 18 deletions.
15 changes: 12 additions & 3 deletions uniqueinstance/testcomponent/fmain.lfm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ object Form1: TForm1
ClientHeight = 280
ClientWidth = 340
Position = poScreenCenter
LCLVersion = '1.3'
LCLVersion = '1.7'
object Label1: TLabel
Left = 8
Height = 15
Expand All @@ -28,16 +28,25 @@ object Form1: TForm1
ItemHeight = 0
TabOrder = 0
end
object ButCrashApp: TButton
object CrashAppButton: TButton
Left = 8
Height = 25
Top = 248
Width = 136
BorderSpacing.InnerBorder = 4
Caption = 'Crash Application'
OnClick = ButCrashAppClick
OnClick = CrashAppButtonClick
TabOrder = 1
end
object ShowDialogButton: TButton
Left = 192
Height = 25
Top = 248
Width = 136
Caption = 'Show Dialog'
OnClick = ShowDialogButtonClick
TabOrder = 2
end
object UniqueInstance1: TUniqueInstance
Enabled = True
Identifier = 'test0.1'
Expand Down
15 changes: 11 additions & 4 deletions uniqueinstance/testcomponent/fmain.pas
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ interface
{ TForm1 }

TForm1 = class(TForm)
ButCrashApp: TButton;
CrashAppButton: TButton;
ShowDialogButton: TButton;
Label1: TLabel;
ListBox1: TListBox;
UniqueInstance1: TUniqueInstance;
procedure ButCrashAppClick(Sender: TObject);
procedure CrashAppButtonClick(Sender: TObject);
procedure ShowDialogButtonClick(Sender: TObject);
procedure UniqueInstance1OtherInstance(Sender: TObject; Count: Integer;
Parameters: array of String);
private
Expand Down Expand Up @@ -50,7 +52,7 @@ procedure TForm1.UniqueInstance1OtherInstance(Sender: TObject; Count: Integer;
var
i:Integer;
begin
Label1.Caption:=Format('A new instance was created with %d parameter(s):', [Count]);
Label1.Caption:=Format('A new instance was created at %s with %d parameter(s):', [TimeToStr(Time), Count]);
ListBox1.Clear;
for i := 0 to Count - 1 do
ListBox1.Items.Add(Parameters[i]);
Expand All @@ -60,7 +62,7 @@ procedure TForm1.UniqueInstance1OtherInstance(Sender: TObject; Count: Integer;
FormStyle := fsNormal;
end;

procedure TForm1.ButCrashAppClick(Sender: TObject);
procedure TForm1.CrashAppButtonClick(Sender: TObject);
begin
{$ifdef unix}
FpKill(FpGetpid, 9);
Expand All @@ -70,5 +72,10 @@ procedure TForm1.ButCrashAppClick(Sender: TObject);
{$endif}
end;

procedure TForm1.ShowDialogButtonClick(Sender: TObject);
begin
Application.MessageBox('Hi! I am a modal Window!', 'Modal Window Check', MB_ICONINFORMATION);
end;

end.

18 changes: 7 additions & 11 deletions uniqueinstance/testcomponent/testinstance.lpi
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<Version Value="10"/>
<PathDelim Value="\"/>
<General>
<Flags>
<LRSInOutputDirectory Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="UniqueInstanceTest"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<Icon Value="0"/>
</General>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1">
<Item1 Name="default" Default="True"/>
</BuildModes>
Expand All @@ -42,7 +39,6 @@
<Unit0>
<Filename Value="testinstance.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="testinstance"/>
</Unit0>
<Unit1>
<Filename Value="fmain.pas"/>
Expand All @@ -57,8 +53,11 @@
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="TestInstance"/>
</Target>
<SearchPaths>
<SrcPath Value="$(LazarusDir)\lcl;$(LazarusDir)\lcl\interfaces\$(LCLWidgetType)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
Expand All @@ -73,10 +72,7 @@
</Options>
</Linking>
<Other>
<CompilerMessages>
<UseMsgFile Value="True"/>
</CompilerMessages>
<CompilerPath Value="$(CompPath)"/>
<CompilerPath Value="C:\bin\code\fpc302rc1\bin\i386-win32\fpc.exe"/>
</Other>
</CompilerOptions>
</CONFIG>
1 change: 1 addition & 0 deletions uniqueinstance/testcomponent/testinstance.lpr
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
{$R *.res}

begin
Application.Title := 'UniqueInstanceTest';
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
Expand Down
Binary file modified uniqueinstance/testcomponent/testinstance.res
Binary file not shown.

0 comments on commit 49ea703

Please sign in to comment.