industral: Use TMultiSlider in IndustrialStuff demo.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6855 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz 2019-04-22 14:00:45 +00:00
parent e4985bdc49
commit 818d8099cb
5 changed files with 91 additions and 43 deletions

View File

@ -1,12 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<CONFIG> <CONFIG>
<ProjectOptions> <ProjectOptions>
<Version Value="11"/> <Version Value="12"/>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<General> <General>
<Flags>
<CompatibilityMode Value="True"/>
</Flags>
<SessionStorage Value="InProjectDir"/> <SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="Ex_IndustrialStuff"/> <Title Value="Ex_IndustrialStuff"/>
<Scaled Value="True"/>
<ResourceType Value="res"/> <ResourceType Value="res"/>
<UseXPManifest Value="True"/> <UseXPManifest Value="True"/>
</General> </General>
@ -18,8 +21,6 @@
</BuildModes> </BuildModes>
<PublishOptions> <PublishOptions>
<Version Value="2"/> <Version Value="2"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
</PublishOptions> </PublishOptions>
<RunParams> <RunParams>
<FormatVersion Value="2"/> <FormatVersion Value="2"/>

View File

@ -14,6 +14,7 @@ uses
begin begin
RequireDerivedFormResource := True; RequireDerivedFormResource := True;
Application.Scaled:=True;
Application.Initialize; Application.Initialize;
Application.CreateForm(TForm1, Form1); Application.CreateForm(TForm1, Form1);
Application.Run; Application.Run;

View File

@ -6,7 +6,7 @@ object Form1: TForm1
Caption = 'IndustrialStuff Example' Caption = 'IndustrialStuff Example'
ClientHeight = 223 ClientHeight = 223
ClientWidth = 824 ClientWidth = 824
LCLVersion = '1.9.0.0' LCLVersion = '2.1.0.0'
object indLed1: TindLed object indLed1: TindLed
Left = 200 Left = 200
Height = 35 Height = 35
@ -61,16 +61,16 @@ object Form1: TForm1
Caption = 'Lazarus' Caption = 'Lazarus'
end end
object AnalogSensor1: TAnalogSensor object AnalogSensor1: TAnalogSensor
Left = 256 Left = 241
Height = 152 Height = 120
Top = 8 Top = 8
Width = 153 Width = 184
BevelOuter = bvNone BevelOuter = bvNone
BorderWidth = 2 BorderWidth = 2
BorderStyle = bsSingle BorderStyle = bsSingle
Caption = 'level : ' Caption = 'level: '
ClientHeight = 148 ClientHeight = 116
ClientWidth = 149 ClientWidth = 180
Font.Height = -16 Font.Height = -16
Font.Name = 'Arial' Font.Name = 'Arial'
ParentColor = False ParentColor = False
@ -80,33 +80,33 @@ object Form1: TForm1
ShowLevel = True ShowLevel = True
ColorRed = clYellow ColorRed = clYellow
ColorYellow = clRed ColorYellow = clRed
Value = 70 Value = 50
ValueMin = 0 ValueMin = 0
ValueMax = 100 ValueMax = 100
ValueRed = 30 ValueRed = 25
ValueYellow = 60 ValueYellow = 75
AnalogKind = akVertical AnalogKind = akVertical
end end
object indGnouMeter1: TindGnouMeter object indGnouMeter1: TindGnouMeter
Left = 424 Left = 440
Height = 143 Height = 155
Top = 17 Top = 13
Width = 120 Width = 120
Caption = 'indGnouMeter1' Caption = 'Voltage'
Value = 70 Value = 50
Color = clPurple Color = clPurple
ParentColor = False ParentColor = False
ColorFore = clRed ColorFore = clRed
ColorBack = clInactiveCaption ColorBack = clInactiveCaption
SignalUnit = 'Units' SignalUnit = 'mV'
ValueMin = 0 ValueMin = 0
ValueMax = 100 ValueMax = 100
Digits = 0 Digits = 0
Increment = 10 Increment = 10
ShowIncrements = True ShowIncrements = True
Transparent = True Transparent = True
GapTop = 20 GapTop = 10
GapBottom = 10 GapBottom = 5
BarThickness = 6 BarThickness = 6
MarkerColor = clBlue MarkerColor = clBlue
ShowMarker = True ShowMarker = True
@ -130,8 +130,8 @@ object Form1: TForm1
end end
object A3nalogGauge1: TA3nalogGauge object A3nalogGauge1: TA3nalogGauge
Left = 568 Left = 568
Height = 192 Height = 207
Top = 16 Top = 8
Width = 241 Width = 241
ArrowWidth = 2 ArrowWidth = 2
Caption = 'mV' Caption = 'mV'
@ -139,19 +139,40 @@ object Form1: TForm1
CaptionFont.Style = [fsBold] CaptionFont.Style = [fsBold]
CenterColor = clSilver CenterColor = clSilver
FaceOptions = [foShowMainTicks, foShowSubTicks, foShowIndicatorMin, foShowIndicatorMid, foShowIndicatorMax, foShowValues, foShowCenter, foShowFrame, foShowCaption] FaceOptions = [foShowMainTicks, foShowSubTicks, foShowIndicatorMin, foShowIndicatorMid, foShowIndicatorMax, foShowValues, foShowCenter, foShowFrame, foShowCaption]
IndMaximum = 60 IndMaximum = 75
IndMinimum = 30 IndMinimum = 25
Position = 70 MidColor = clGreen
MinColor = clYellow
Position = 50
end end
object TrackBar1: TTrackBar object MultiSlider1: TMultiSlider
Left = 32 Left = 25
Height = 25 Height = 35
Top = 184 Top = 180
Width = 504 Width = 504
Frequency = 10 ColorBetween = 16481536
Max = 100 ColorThumb = 10768896
OnChange = TrackBar1Change MaxPosition = 75
Position = 70 MinPosition = 25
TabOrder = 2 SliderMode = smMinValueMax
ThumbStyle = tsTriangle
OnPositionChange = MultiSlider1PositionChange
end
object ComboBox1: TComboBox
Left = 255
Height = 23
Top = 138
Width = 153
ItemHeight = 15
ItemIndex = 2
Items.Strings = (
'akAnalog'
'akHorizontal'
'akVertical'
)
OnChange = ComboBox1Change
Style = csDropDownList
TabOrder = 3
Text = 'akVertical'
end end
end end

View File

@ -6,7 +6,8 @@ interface
uses uses
Classes, SysUtils, FileUtil, IndLed, Sensors, LedNumber, IndGnouMeter, AdvLed, Classes, SysUtils, FileUtil, IndLed, Sensors, LedNumber, IndGnouMeter, AdvLed,
A3nalogGauge, Forms, Controls, Graphics, Dialogs, Arrow, ComCtrls; A3nalogGauge, indSliders, Forms, Controls, Graphics, Dialogs, Arrow, ComCtrls,
StdCtrls;
type type
@ -17,12 +18,15 @@ type
AdvLed1: TAdvLed; AdvLed1: TAdvLed;
AnalogSensor1: TAnalogSensor; AnalogSensor1: TAnalogSensor;
Arrow1: TArrow; Arrow1: TArrow;
ComboBox1: TComboBox;
indGnouMeter1: TindGnouMeter; indGnouMeter1: TindGnouMeter;
indLed1: TindLed; indLed1: TindLed;
LEDNumber1: TLEDNumber; LEDNumber1: TLEDNumber;
MultiSlider1: TMultiSlider;
StopLightSensor1: TStopLightSensor; StopLightSensor1: TStopLightSensor;
TrackBar1: TTrackBar; procedure ComboBox1Change(Sender: TObject);
procedure TrackBar1Change(Sender: TObject); procedure MultiSlider1PositionChange(Sender: TObject; AKind: TThumbKind;
AValue: Integer);
private private
public public
@ -38,11 +42,32 @@ implementation
{ TForm1 } { TForm1 }
procedure TForm1.TrackBar1Change(Sender: TObject); procedure TForm1.MultiSlider1PositionChange(Sender: TObject; AKind: TThumbKind;
AValue: Integer);
begin begin
A3nalogGauge1.Position := Trackbar1.Position; case AKind of
indGnouMeter1.Value := Trackbar1.Position; tkValue:
AnalogSensor1.Value := Trackbar1.Position; begin
A3nalogGauge1.Position := MultiSlider1.Position;
indGnouMeter1.Value := MultiSlider1.Position;
AnalogSensor1.Value := MultiSlider1.Position;
end;
tkMin:
begin
A3nalogGauge1.IndMinimum := MultiSlider1.MinPosition;
AnalogSensor1.ValueRed := MultiSlider1.MinPosition;
end;
tkMax:
begin
A3nalogGauge1.IndMaximum := MultiSlider1.MaxPosition;
AnalogSensor1.ValueYellow := MultiSlider1.MaxPosition;
end;
end;
end;
procedure TForm1.ComboBox1Change(Sender: TObject);
begin
AnalogSensor1.AnalogKind := TAnalogKind(ComboBox1.ItemIndex);
end; end;
end. end.