You've already forked lazarus-ccr
industrialstuff: Version 0.3. Add TmKnob and TmOnOffSwitch. High-dpi palette icons for TA3nalogGauge, TmKnow and TOnOffSwitch.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6770 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -0,0 +1,82 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<Title Value="demo"/>
|
||||
<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"/>
|
||||
<UseFileFilters Value="True"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
<Modes Count="0"/>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="2">
|
||||
<Item1>
|
||||
<PackageName Value="industrial"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item2>
|
||||
</RequiredPackages>
|
||||
<Units Count="2">
|
||||
<Unit0>
|
||||
<Filename Value="demo.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="main.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="MainForm"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="demo"/>
|
||||
</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>
|
@ -0,0 +1,22 @@
|
||||
program demo;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||
cthreads,
|
||||
{$ENDIF}{$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms, main
|
||||
{ you can add units after this };
|
||||
|
||||
{$R *.res}
|
||||
|
||||
begin
|
||||
RequireDerivedFormResource:=True;
|
||||
Application.Scaled:=True;
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TMainForm, MainForm);
|
||||
Application.Run;
|
||||
end.
|
||||
|
@ -0,0 +1,50 @@
|
||||
object MainForm: TMainForm
|
||||
Left = 282
|
||||
Height = 305
|
||||
Top = 133
|
||||
Width = 248
|
||||
Caption = 'Demo'
|
||||
ClientHeight = 305
|
||||
ClientWidth = 248
|
||||
OnCreate = FormCreate
|
||||
LCLVersion = '2.1.0.0'
|
||||
object Knob: TmKnob
|
||||
Left = 104
|
||||
Height = 96
|
||||
Top = 200
|
||||
Width = 88
|
||||
Position = 0
|
||||
MarkStyle = msCircle
|
||||
OnChange = KnobChange
|
||||
end
|
||||
object OnOffSwitch: TOnOffSwitch
|
||||
Left = 15
|
||||
Height = 30
|
||||
Top = 216
|
||||
Width = 60
|
||||
CaptionOFF = 'OFF'
|
||||
CaptionON = 'ON'
|
||||
Checked = True
|
||||
OnChange = OnOffSwitchChange
|
||||
TabOrder = 1
|
||||
end
|
||||
object AnalogGauge: TA3nalogGauge
|
||||
Left = 8
|
||||
Height = 190
|
||||
Top = 8
|
||||
Width = 232
|
||||
Caption = 'Volts'
|
||||
CaptionFont.Height = -19
|
||||
CaptionFont.Style = [fsBold]
|
||||
Position = 0
|
||||
end
|
||||
object Edit: TEdit
|
||||
Left = 15
|
||||
Height = 23
|
||||
Top = 264
|
||||
Width = 61
|
||||
Alignment = taRightJustify
|
||||
OnEditingDone = EditEditingDone
|
||||
TabOrder = 3
|
||||
end
|
||||
end
|
@ -0,0 +1,66 @@
|
||||
unit main;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, MKnob,
|
||||
switches, A3nalogGauge;
|
||||
|
||||
type
|
||||
|
||||
{ TMainForm }
|
||||
|
||||
TMainForm = class(TForm)
|
||||
AnalogGauge: TA3nalogGauge;
|
||||
Edit: TEdit;
|
||||
Knob: TmKnob;
|
||||
OnOffSwitch: TOnOffSwitch;
|
||||
procedure EditEditingDone(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure KnobChange(Sender: TObject; AValue: Longint);
|
||||
procedure OnOffSwitchChange(Sender: TObject);
|
||||
private
|
||||
|
||||
public
|
||||
|
||||
end;
|
||||
|
||||
var
|
||||
MainForm: TMainForm;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
{ TMainForm }
|
||||
|
||||
procedure TMainForm.EditEditingDone(Sender: TObject);
|
||||
var
|
||||
s: String;
|
||||
begin
|
||||
s := Edit.Text;
|
||||
while (s <> '') and not (s[Length(s)] in ['0'..'9']) do
|
||||
SetLength(s, Length(s)-1);
|
||||
Knob.Position := StrToInt(s);
|
||||
end;
|
||||
|
||||
procedure TMainForm.FormCreate(Sender: TObject);
|
||||
begin
|
||||
Knob.Position := 40;
|
||||
end;
|
||||
|
||||
procedure TMainForm.KnobChange(Sender: TObject; AValue: Longint);
|
||||
begin
|
||||
AnalogGauge.Position := Knob.Position;
|
||||
Edit.Text := IntToStr(Knob.Position) + ' V';
|
||||
end;
|
||||
|
||||
procedure TMainForm.OnOffSwitchChange(Sender: TObject);
|
||||
begin
|
||||
Knob.AllowUserDrag := OnOffSwitch.Checked
|
||||
end;
|
||||
|
||||
end.
|
||||
|
Reference in New Issue
Block a user