jvcllaz: Add demo for TJvDialButton

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6657 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2018-09-26 15:12:28 +00:00
parent 13982ed8b1
commit 1f4d743bc7
4 changed files with 337 additions and 0 deletions

View File

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<General>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="JvDialButtonDemo"/>
<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="jvhmilazr"/>
</Item1>
<Item2>
<PackageName Value="LCL"/>
</Item2>
</RequiredPackages>
<Units Count="2">
<Unit0>
<Filename Value="JvDialButtonDemo.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
<Unit1>
<Filename Value="jvdialbuttondemoform.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="JvDialButtonDemoForm"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="..\..\bin\JvDialButtonDemo"/>
</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 JvDialButtonDemo;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, JvDialButtonDemoForm
{ 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,139 @@
object Form1: TForm1
Left = 345
Height = 290
Top = 131
Width = 320
Caption = 'Form1'
ClientHeight = 290
ClientWidth = 320
OnCreate = FormCreate
LCLVersion = '2.1.0.0'
object JvDialButton1: TJvDialButton
Left = 40
Height = 120
Top = 24
Width = 120
ButtonEdge = 5
Color = clMoneyGreen
DefaultPos = 0
ParentColor = False
PointerPenWidth = 3
Radius = 48
TickStyle = tsAuto
TabOrder = 0
OnChange = JvDialButton1Change
end
object JvLED1: TJvLED
Left = 197
Top = 24
ColorOn = clRed
ColorOff = clMaroon
Status = False
end
object JvLED2: TJvLED
Left = 197
Top = 40
ColorOn = clRed
ColorOff = clMaroon
Status = False
end
object JvLED3: TJvLED
Left = 197
Top = 56
ColorOn = clYellow
ColorOff = clOlive
Status = False
end
object JvLED4: TJvLED
Left = 197
Top = 72
ColorOn = clYellow
ColorOff = clOlive
Status = False
end
object JvLED5: TJvLED
Left = 197
Top = 88
ColorOff = clGreen
Status = False
end
object JvLED6: TJvLED
Left = 197
Top = 104
ColorOff = clGreen
Status = False
end
object JvLED7: TJvLED
Left = 197
Top = 120
ColorOff = clGreen
Status = False
end
object JvLED8: TJvLED
Left = 197
Top = 136
ColorOff = clGreen
Status = False
end
object JvLED9: TJvLED
Left = 197
Top = 152
ColorOff = clGreen
Status = False
end
object JvLED10: TJvLED
Left = 197
Top = 168
ColorOff = clGreen
Status = False
end
object cmbPointerShape: TComboBox
Left = 40
Height = 23
Top = 202
Width = 132
ItemHeight = 15
ItemIndex = 2
Items.Strings = (
'psLine'
'psTriangle'
'psDot'
)
OnChange = cmbPointerShapeChange
Style = csDropDownList
TabOrder = 1
Text = 'psDot'
end
object lblPointerShape: TLabel
Left = 40
Height = 15
Top = 184
Width = 72
Caption = 'Pointer shape'
ParentColor = False
end
object lblBorderStyle: TLabel
Left = 40
Height = 15
Top = 232
Width = 62
Caption = 'Border style'
ParentColor = False
end
object cmbBorderStyle: TComboBox
Left = 40
Height = 23
Top = 250
Width = 132
ItemHeight = 15
ItemIndex = 0
Items.Strings = (
'bsNone'
'bsSingle'
)
OnChange = cmbBorderStyleChange
Style = csDropDownList
TabOrder = 2
Text = 'bsNone'
end
end

View File

@ -0,0 +1,93 @@
unit JvDialButtonDemoForm;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, JvDialButton,
JvLED;
type
{ TForm1 }
TForm1 = class(TForm)
cmbPointerShape: TComboBox;
cmbBorderStyle: TComboBox;
JvDialButton1: TJvDialButton;
JvLED1: TJvLED;
JvLED10: TJvLED;
JvLED2: TJvLED;
JvLED3: TJvLED;
JvLED4: TJvLED;
JvLED5: TJvLED;
JvLED6: TJvLED;
JvLED7: TJvLED;
JvLED8: TJvLED;
JvLED9: TJvLED;
lblPointerShape: TLabel;
lblBorderStyle: TLabel;
procedure cmbBorderStyleChange(Sender: TObject);
procedure cmbPointerShapeChange(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure JvDialButton1Change(Sender: TObject);
private
FLEDs: array[0..9] of TJvLED;
FReady: Boolean;
public
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.JvDialButton1Change(Sender: TObject);
var
i: Integer;
begin
if not FReady then
exit;
for i := Low(FLEDs) to High(FLEDs) do
FLEDs[i].Status := JvDialButton1.Position > i*10;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
FLEDs[0] := JvLED10;
FLEDs[1] := JvLED9;
FLEDs[2] := JvLED8;
FLEDs[3] := JvLED7;
FLEDs[4] := JvLED6;
FLEDs[5] := JvLED5;
FLEDs[6] := JvLED4;
FLEDs[7] := JvLED3;
FLEDs[8] := JvLED2;
FLEDs[9] := JVLED1;
FReady := true;
cmbPointerShapeChange(nil);
end;
procedure TForm1.cmbPointerShapeChange(Sender: TObject);
begin
JvDialButton1.PointerShape := TJvDialPointerShape(cmbPointerShape.ItemIndex);
end;
procedure TForm1.cmbBorderStyleChange(Sender: TObject);
begin
case cmbBorderStyle.ItemIndex of
0: JvDialButton1.BorderStyle := bsNone;
1: JvDialButton1.BorderStyle := bsSingle;
end;
end;
end.