RxFPC:fix size of TRxDice + demo

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6528 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75
2018-06-25 07:03:10 +00:00
parent 5c885a5837
commit a261368a22
24 changed files with 657 additions and 878 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

View File

@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="11"/>
<General>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="project1"/>
<Scaled Value="True"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<XPManifest>
<DpiAware Value="True"/>
</XPManifest>
<Icon Value="0"/>
</General>
<BuildModes Count="1">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
</PublishOptions>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="0"/>
</RunParams>
<RequiredPackages Count="2">
<Item1>
<PackageName Value="rxnew"/>
</Item1>
<Item2>
<PackageName Value="LCL"/>
</Item2>
</RequiredPackages>
<Units Count="2">
<Unit0>
<Filename Value="project1.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
<Unit1>
<Filename Value="unit1.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="Unit1"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="project1"/>
</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,22 @@
program project1;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, Unit1, rxnew
{ you can add units after this };
{$R *.res}
begin
RequireDerivedFormResource:=True;
Application.Scaled:=True;
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

View File

@@ -0,0 +1,309 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectSession>
<Version Value="11"/>
<BuildModes Active="Default"/>
<Units Count="23">
<Unit0>
<Filename Value="project1.lpr"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="-1"/>
<WindowIndex Value="-1"/>
<TopLine Value="-1"/>
<CursorPos X="-1" Y="-1"/>
<UsageCount Value="21"/>
</Unit0>
<Unit1>
<Filename Value="unit1.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="Unit1"/>
<IsVisibleTab Value="True"/>
<TopLine Value="39"/>
<CursorPos X="9" Y="62"/>
<UsageCount Value="21"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit1>
<Unit2>
<Filename Value="../../rxcontrols/rxdice.pas"/>
<UnitName Value="rxDice"/>
<EditorIndex Value="1"/>
<TopLine Value="372"/>
<CursorPos Y="404"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit2>
<Unit3>
<Filename Value="../../rxcontrols/rxdice.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="5"/>
<CursorPos X="3" Y="5"/>
<UsageCount Value="10"/>
</Unit3>
<Unit4>
<Filename Value="../../../../lcl/include/lclintfh.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="35"/>
<CursorPos X="10" Y="52"/>
<UsageCount Value="10"/>
</Unit4>
<Unit5>
<Filename Value="../../rxcontrols/rxswitch.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="291"/>
<CursorPos Y="329"/>
<UsageCount Value="10"/>
</Unit5>
<Unit6>
<Filename Value="../../rxcontrols/rxlclutils.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="73"/>
<CursorPos X="26" Y="90"/>
<UsageCount Value="10"/>
</Unit6>
<Unit7>
<Filename Value="/home/install/source/fpcsrc/rtl/objpas/classes/streams.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="959"/>
<CursorPos X="22" Y="988"/>
<UsageCount Value="10"/>
</Unit7>
<Unit8>
<Filename Value="../../../../lcl/lmessages.pp"/>
<UnitName Value="LMessages"/>
<EditorIndex Value="-1"/>
<TopLine Value="69"/>
<CursorPos Y="69"/>
<UsageCount Value="10"/>
</Unit8>
<Unit9>
<Filename Value="../../../jvcllaz/run/JvXPCtrls/JvXPCore.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="398"/>
<CursorPos X="24" Y="417"/>
<UsageCount Value="10"/>
</Unit9>
<Unit10>
<Filename Value="../../../../lcl/controls.pp"/>
<UnitName Value="Controls"/>
<EditorIndex Value="2"/>
<TopLine Value="2102"/>
<CursorPos Y="2113"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit10>
<Unit11>
<Filename Value="../../../../lcl/interfaces/customdrawn/wincallback.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="827"/>
<CursorPos X="35" Y="843"/>
<UsageCount Value="10"/>
</Unit11>
<Unit12>
<Filename Value="../../../../lcl/include/controlconsts.inc"/>
<EditorIndex Value="-1"/>
<UsageCount Value="10"/>
</Unit12>
<Unit13>
<Filename Value="../../../virtualtreeview/VirtualTrees.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="14490"/>
<CursorPos X="18" Y="14518"/>
<UsageCount Value="10"/>
</Unit13>
<Unit14>
<Filename Value="../../../jvcllaz/run/JvXPCtrls/JvXPButtons.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="396"/>
<CursorPos X="20" Y="413"/>
<UsageCount Value="10"/>
</Unit14>
<Unit15>
<Filename Value="../../../jvcllaz/run/JvCore/JvExControls.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="154"/>
<CursorPos X="15" Y="171"/>
<UsageCount Value="10"/>
</Unit15>
<Unit16>
<Filename Value="../../../jvcllaz/run/JvCore/JvExExtCtrls.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="72"/>
<CursorPos X="15" Y="89"/>
<UsageCount Value="10"/>
</Unit16>
<Unit17>
<Filename Value="../../../../lcl/include/control.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="338"/>
<CursorPos X="3" Y="357"/>
<UsageCount Value="10"/>
</Unit17>
<Unit18>
<Filename Value="../../../../lcl/include/wincontrol.inc"/>
<EditorIndex Value="3"/>
<TopLine Value="6766"/>
<CursorPos X="3" Y="6777"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit18>
<Unit19>
<Filename Value="../../../../lcl/lclintf.pas"/>
<UnitName Value="LCLIntf"/>
<EditorIndex Value="-1"/>
<TopLine Value="155"/>
<CursorPos X="24" Y="155"/>
<UsageCount Value="10"/>
</Unit19>
<Unit20>
<Filename Value="../../../lazutils/lazutf8sysutils.pas"/>
<UnitName Value="LazUTF8SysUtils"/>
<EditorIndex Value="-1"/>
<TopLine Value="36"/>
<CursorPos X="3" Y="39"/>
<UsageCount Value="10"/>
</Unit20>
<Unit21>
<Filename Value="/home/install/source/fpcsrc/rtl/objpas/sysutils/sysutilh.inc"/>
<EditorIndex Value="-1"/>
<CursorPos X="10" Y="29"/>
<UsageCount Value="10"/>
</Unit21>
<Unit22>
<Filename Value="/home/install/source/fpcsrc/rtl/unix/sysutils.pp"/>
<EditorIndex Value="-1"/>
<TopLine Value="345"/>
<CursorPos X="16" Y="345"/>
<UsageCount Value="10"/>
</Unit22>
</Units>
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="../../rxcontrols/rxdice.pas"/>
<Caret Line="199" Column="12" TopLine="191"/>
</Position1>
<Position2>
<Filename Value="../../rxcontrols/rxdice.pas"/>
<Caret Line="321" Column="23" TopLine="293"/>
</Position2>
<Position3>
<Filename Value="../../rxcontrols/rxdice.pas"/>
<Caret Line="323" Column="12" TopLine="295"/>
</Position3>
<Position4>
<Filename Value="../../rxcontrols/rxdice.pas"/>
<Caret Line="77" Column="15" TopLine="56"/>
</Position4>
<Position5>
<Filename Value="../../rxcontrols/rxdice.pas"/>
<Caret Line="282" Column="3" TopLine="259"/>
</Position5>
<Position6>
<Filename Value="../../rxcontrols/rxdice.pas"/>
<Caret Line="285" Column="15" TopLine="259"/>
</Position6>
<Position7>
<Filename Value="../../rxcontrols/rxdice.pas"/>
<Caret Line="61" TopLine="44"/>
</Position7>
<Position8>
<Filename Value="../../rxcontrols/rxdice.pas"/>
<Caret Line="217" TopLine="207"/>
</Position8>
<Position9>
<Filename Value="../../rxcontrols/rxdice.pas"/>
<Caret Line="82" Column="7" TopLine="50"/>
</Position9>
<Position10>
<Filename Value="../../rxcontrols/rxdice.pas"/>
<Caret Line="209" TopLine="176"/>
</Position10>
<Position11>
<Filename Value="../../rxcontrols/rxdice.pas"/>
<Caret Line="45" Column="13" TopLine="28"/>
</Position11>
<Position12>
<Filename Value="../../rxcontrols/rxdice.pas"/>
<Caret Line="209" Column="19" TopLine="190"/>
</Position12>
<Position13>
<Filename Value="../../rxcontrols/rxdice.pas"/>
<Caret Line="61" Column="5" TopLine="31"/>
</Position13>
<Position14>
<Filename Value="../../rxcontrols/rxdice.pas"/>
<Caret Line="342" Column="3" TopLine="317"/>
</Position14>
<Position15>
<Filename Value="../../rxcontrols/rxdice.pas"/>
<Caret Line="192" Column="33" TopLine="186"/>
</Position15>
<Position16>
<Filename Value="../../rxcontrols/rxdice.pas"/>
</Position16>
<Position17>
<Filename Value="../../rxcontrols/rxdice.pas"/>
<Caret Line="192" Column="33" TopLine="164"/>
</Position17>
<Position18>
<Filename Value="../../rxcontrols/rxdice.pas"/>
<Caret Line="392" Column="26" TopLine="382"/>
</Position18>
<Position19>
<Filename Value="../../rxcontrols/rxdice.pas"/>
<Caret Line="393" Column="26" TopLine="382"/>
</Position19>
<Position20>
<Filename Value="unit1.pas"/>
<Caret Line="42" Column="38" TopLine="14"/>
</Position20>
<Position21>
<Filename Value="unit1.pas"/>
<Caret Line="41" TopLine="14"/>
</Position21>
<Position22>
<Filename Value="unit1.pas"/>
<Caret Line="42" TopLine="14"/>
</Position22>
<Position23>
<Filename Value="unit1.pas"/>
<Caret Line="44" TopLine="16"/>
</Position23>
<Position24>
<Filename Value="../../rxcontrols/rxdice.pas"/>
<Caret Line="380" TopLine="363"/>
</Position24>
<Position25>
<Filename Value="../../rxcontrols/rxdice.pas"/>
<Caret Line="404" TopLine="372"/>
</Position25>
<Position26>
<Filename Value="unit1.pas"/>
<Caret Line="42" Column="36" TopLine="16"/>
</Position26>
<Position27>
<Filename Value="unit1.pas"/>
<Caret Line="56" TopLine="24"/>
</Position27>
<Position28>
<Filename Value="unit1.pas"/>
<Caret Line="57" TopLine="25"/>
</Position28>
<Position29>
<Filename Value="unit1.pas"/>
<Caret Line="47" Column="11" TopLine="25"/>
</Position29>
<Position30>
<Filename Value="unit1.pas"/>
<Caret Line="48" TopLine="33"/>
</Position30>
</JumpHistory>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="0" ActiveMode=""/>
</RunParams>
</ProjectSession>
</CONFIG>

Binary file not shown.

View File

@@ -0,0 +1,113 @@
object Form1: TForm1
Left = 319
Height = 291
Top = 138
Width = 409
Caption = 'RxDice demo'
ClientHeight = 291
ClientWidth = 409
OnCreate = FormCreate
Position = poScreenCenter
LCLVersion = '1.9.0.0'
object RxDice1: TRxDice
Left = 40
Height = 66
Top = 24
Width = 66
AutoStopInterval = 1000
Interval = 100
Rotate = False
ShowFocus = True
TabOrder = 0
TabStop = True
OnStart = RxDice1Start
OnStop = RxDice1Stop
end
object Button1: TButton
AnchorSideLeft.Control = Owner
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = SpinEdit2
AnchorSideTop.Side = asrBottom
Left = 181
Height = 36
Top = 144
Width = 47
AutoSize = True
BorderSpacing.Around = 6
Caption = 'Start'
OnClick = Button1Click
TabOrder = 1
end
object Label1: TLabel
AnchorSideLeft.Control = Label3
AnchorSideTop.Control = Owner
Left = 210
Height = 20
Top = 6
Width = 85
BorderSpacing.Around = 6
Caption = 'Rotate speed'
ParentColor = False
end
object SpinEdit1: TSpinEdit
AnchorSideLeft.Control = Label1
AnchorSideTop.Control = Label1
AnchorSideTop.Side = asrBottom
Left = 216
Height = 37
Top = 32
Width = 146
BorderSpacing.Around = 6
MaxValue = 10000
TabOrder = 2
Value = 110
end
object Label2: TLabel
AnchorSideLeft.Control = Label3
AnchorSideTop.Control = SpinEdit1
AnchorSideTop.Side = asrBottom
Left = 210
Height = 20
Top = 75
Width = 93
BorderSpacing.Around = 6
Caption = 'Rotate interval'
ParentColor = False
end
object SpinEdit2: TSpinEdit
AnchorSideLeft.Control = Label2
AnchorSideTop.Control = Label2
AnchorSideTop.Side = asrBottom
Left = 216
Height = 37
Top = 101
Width = 146
BorderSpacing.Around = 6
MaxValue = 10000
TabOrder = 3
Value = 200
end
object Label3: TLabel
AnchorSideLeft.Control = Owner
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = Owner
Left = 204
Height = 1
Top = 0
Width = 1
ParentColor = False
end
object Label4: TLabel
AnchorSideLeft.Control = Owner
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = Button1
AnchorSideTop.Side = asrBottom
Left = 157
Height = 20
Top = 186
Width = 94
BorderSpacing.Around = 6
Caption = 'Current value :'
ParentColor = False
end
end

View File

@@ -0,0 +1,73 @@
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, Spin, rxdice,
rxswitch;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
RxDice1: TRxDice;
SpinEdit1: TSpinEdit;
SpinEdit2: TSpinEdit;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure RxDice1Start(Sender: TObject);
procedure RxDice1Stop(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
begin
RxDice1.Interval:=SpinEdit1.Value;
RxDice1.AutoStopInterval:=SpinEdit2.Value * 10;
RxDice1.Rotate:=true;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
RxDice1.RandomValue;
RxDice1Stop(nil);
end;
procedure TForm1.RxDice1Start(Sender: TObject);
begin
SpinEdit1.Enabled:=not RxDice1.Rotate;
SpinEdit2.Enabled:=not RxDice1.Rotate;
Label1.Enabled:=not RxDice1.Rotate;
Label2.Enabled:=not RxDice1.Rotate;
Label4.Enabled:=not RxDice1.Rotate;
Button1.Enabled:=not RxDice1.Rotate;
end;
procedure TForm1.RxDice1Stop(Sender: TObject);
begin
RxDice1Start(nil);
Label4.Caption:=Format('Current value : %d', [RxDice1.Value]);
end;
end.