You've already forked lazarus-ccr
RxFPC:vertical demo for RxRangeSelector
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6022 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -18,8 +18,9 @@
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="Unit1"/>
|
||||
<TopLine Value="6"/>
|
||||
<CursorPos X="34" Y="19"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<TopLine Value="22"/>
|
||||
<CursorPos X="29" Y="49"/>
|
||||
<UsageCount Value="42"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
@@ -34,10 +35,9 @@
|
||||
<Unit3>
|
||||
<Filename Value="../../rxcontrols/rxrangesel.pas"/>
|
||||
<UnitName Value="RxRangeSel"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="64"/>
|
||||
<CursorPos X="14" Y="80"/>
|
||||
<TopLine Value="112"/>
|
||||
<CursorPos X="14" Y="127"/>
|
||||
<UsageCount Value="33"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit3>
|
||||
@@ -206,10 +206,11 @@
|
||||
<Unit26>
|
||||
<Filename Value="../../../../lcl/comctrls.pp"/>
|
||||
<UnitName Value="ComCtrls"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="336"/>
|
||||
<CursorPos X="16" Y="367"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<TopLine Value="2609"/>
|
||||
<CursorPos X="23" Y="2625"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit26>
|
||||
<Unit27>
|
||||
<Filename Value="../../rxcontrols/rxaboutdialog.pas"/>
|
||||
@@ -439,7 +440,7 @@
|
||||
<UsageCount Value="10"/>
|
||||
</Unit57>
|
||||
</Units>
|
||||
<JumpHistory Count="21" HistoryIndex="20">
|
||||
<JumpHistory Count="27" HistoryIndex="26">
|
||||
<Position1>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="20" Column="5"/>
|
||||
@@ -524,6 +525,30 @@
|
||||
<Filename Value="../../rxcontrols/rxrangesel.pas"/>
|
||||
<Caret Line="208" Column="3" TopLine="204"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="19" Column="34" TopLine="6"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="38" Column="15" TopLine="6"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="45" Column="40" TopLine="19"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="../../rxcontrols/rxrangesel.pas"/>
|
||||
<Caret Line="148" Column="14" TopLine="129"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="../../rxcontrols/rxrangesel.pas"/>
|
||||
<Caret Line="127" Column="14" TopLine="112"/>
|
||||
</Position26>
|
||||
<Position27>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="45" Column="40" TopLine="19"/>
|
||||
</Position27>
|
||||
</JumpHistory>
|
||||
</ProjectSession>
|
||||
</CONFIG>
|
||||
|
@@ -1,21 +1,21 @@
|
||||
object Form1: TForm1
|
||||
Left = 488
|
||||
Height = 275
|
||||
Top = 15
|
||||
Width = 563
|
||||
Left = 516
|
||||
Height = 581
|
||||
Top = 190
|
||||
Width = 603
|
||||
Caption = 'Form1'
|
||||
ClientHeight = 275
|
||||
ClientWidth = 563
|
||||
ClientHeight = 581
|
||||
ClientWidth = 603
|
||||
LCLVersion = '1.9.0.0'
|
||||
object Label1: TLabel
|
||||
AnchorSideLeft.Control = RxRangeSelector1
|
||||
AnchorSideLeft.Side = asrCenter
|
||||
AnchorSideTop.Control = RxRangeSelector1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 260
|
||||
Height = 20
|
||||
Top = 159
|
||||
Width = 42
|
||||
Left = 289
|
||||
Height = 13
|
||||
Top = 146
|
||||
Width = 31
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'Label1'
|
||||
ParentColor = False
|
||||
@@ -24,12 +24,13 @@ object Form1: TForm1
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideLeft.Side = asrCenter
|
||||
AnchorSideTop.Control = Owner
|
||||
Left = 225
|
||||
Height = 93
|
||||
Top = 0
|
||||
Width = 112
|
||||
Left = 256
|
||||
Height = 69
|
||||
Top = 6
|
||||
Width = 90
|
||||
AutoFill = True
|
||||
AutoSize = True
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'Style'
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||
@@ -38,9 +39,9 @@ object Form1: TForm1
|
||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 1
|
||||
ClientHeight = 72
|
||||
ClientWidth = 110
|
||||
ItemIndex = 0
|
||||
ClientHeight = 51
|
||||
ClientWidth = 86
|
||||
ItemIndex = 1
|
||||
Items.Strings = (
|
||||
'rxrsSimple'
|
||||
'rxrsLazarus'
|
||||
@@ -50,16 +51,12 @@ object Form1: TForm1
|
||||
TabOrder = 0
|
||||
end
|
||||
object RxRangeSelector1: TRxRangeSelector
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = RadioGroup1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 0
|
||||
Left = 104
|
||||
Height = 60
|
||||
Top = 93
|
||||
Width = 563
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
Top = 80
|
||||
Width = 400
|
||||
Min = 0
|
||||
Max = 100
|
||||
SelectedStart = 0
|
||||
@@ -147,4 +144,32 @@ object Form1: TForm1
|
||||
D6FF2559D6FF1D53D4FF1D53D4FF1D53D3FF0F3A9EFF0F3A9FFF103BA1FF
|
||||
}
|
||||
end
|
||||
object RadioGroup2: TRadioGroup
|
||||
AnchorSideLeft.Control = RadioGroup1
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = Owner
|
||||
Left = 352
|
||||
Height = 52
|
||||
Top = 6
|
||||
Width = 90
|
||||
AutoFill = True
|
||||
AutoSize = True
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'Orientation'
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||
ChildSizing.EnlargeVertical = crsHomogenousChildResize
|
||||
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 1
|
||||
ClientHeight = 34
|
||||
ClientWidth = 86
|
||||
Items.Strings = (
|
||||
'trHorizontal'
|
||||
'trVertical'
|
||||
)
|
||||
OnClick = RadioGroup2Click
|
||||
TabOrder = 2
|
||||
end
|
||||
end
|
||||
|
@@ -15,8 +15,10 @@ type
|
||||
TForm1 = class(TForm)
|
||||
Label1: TLabel;
|
||||
RadioGroup1: TRadioGroup;
|
||||
RadioGroup2: TRadioGroup;
|
||||
RxRangeSelector1: TRxRangeSelector;
|
||||
procedure RadioGroup1Click(Sender: TObject);
|
||||
procedure RadioGroup2Click(Sender: TObject);
|
||||
procedure RxRangeSelector1Change(Sender: TObject);
|
||||
private
|
||||
public
|
||||
@@ -37,6 +39,16 @@ begin
|
||||
RxRangeSelector1.Style:=TRxRangeSelectorStyle(RadioGroup1.ItemIndex);
|
||||
end;
|
||||
|
||||
procedure TForm1.RadioGroup2Click(Sender: TObject);
|
||||
var
|
||||
W: Integer;
|
||||
begin
|
||||
RxRangeSelector1.Orientation:=TTrackBarOrientation(RadioGroup2.ItemIndex);
|
||||
W:=RxRangeSelector1.Width;
|
||||
RxRangeSelector1.Width:=RxRangeSelector1.Height;
|
||||
RxRangeSelector1.Height:=W;
|
||||
end;
|
||||
|
||||
procedure TForm1.RxRangeSelector1Change(Sender: TObject);
|
||||
begin
|
||||
Label1.Caption:=FloatToStr(RxRangeSelector1.SelectedStart) + ' - ' + FloatToStr(RxRangeSelector1.SelectedEnd);
|
||||
|
@@ -324,7 +324,10 @@ begin
|
||||
{$IFDEF WINDOWS}
|
||||
if (FStyle = rxrsNative) and ThemeServices.ThemesEnabled then
|
||||
begin
|
||||
TD:=ThemeServices.GetElementDetails(ttbThumbBottomPressed);
|
||||
if FOrientation = trHorizontal then
|
||||
TD:=ThemeServices.GetElementDetails(ttbThumbBottomPressed)
|
||||
else
|
||||
TD:=ThemeServices.GetElementDetails(ttbThumbRightPressed);
|
||||
FThumbSize:=ThemeServices.GetDetailSize(TD);
|
||||
end
|
||||
else
|
||||
@@ -400,9 +403,12 @@ function TRxCustomRangeSelector.LogicalToScreen(const LogicalPos: double
|
||||
): double;
|
||||
begin
|
||||
if FOrientation = trHorizontal then
|
||||
Result := FThumbSize.CX + BarWidth * (LogicalPos - FMin) / (FMax - FMin)
|
||||
Result := FThumbSize.CX
|
||||
else
|
||||
Result := FThumbSize.CY + BarWidth * (LogicalPos - FMin) / (FMax - FMin)
|
||||
Result := FThumbSize.CY;
|
||||
|
||||
if (FMax - FMin) > 0 then
|
||||
Result := Result + BarWidth * (LogicalPos - FMin) / (FMax - FMin)
|
||||
end;
|
||||
|
||||
function TRxCustomRangeSelector.BarWidth: integer;
|
||||
@@ -488,16 +494,29 @@ begin
|
||||
{$IFDEF WINDOWS}
|
||||
if (FStyle = rxrsNative) and ThemeServices.ThemesEnabled then
|
||||
begin
|
||||
DE:=ThemeServices.GetElementDetails(ttbThumbBottomPressed);
|
||||
if FOrientation = trHorizontal then
|
||||
DE:=ThemeServices.GetElementDetails(ttbThumbBottomPressed)
|
||||
else
|
||||
DE:=ThemeServices.GetElementDetails(ttbThumbRightPressed);
|
||||
|
||||
ThemeServices.DrawElement( Canvas.Handle, DE, FThumbPosTop);
|
||||
|
||||
DE:=ThemeServices.GetElementDetails(ttbThumbTopPressed);
|
||||
if FOrientation = trHorizontal then
|
||||
DE:=ThemeServices.GetElementDetails(ttbThumbTopPressed)
|
||||
else
|
||||
DE:=ThemeServices.GetElementDetails(ttbThumbLeftPressed);
|
||||
ThemeServices.DrawElement( Canvas.Handle, DE, FThumbPosBottom);
|
||||
|
||||
DE:=ThemeServices.GetElementDetails(ttbTrack);
|
||||
if FOrientation = trHorizontal then
|
||||
DE:=ThemeServices.GetElementDetails(ttbTrack)
|
||||
else
|
||||
DE:=ThemeServices.GetElementDetails(ttbTrackVert);
|
||||
ThemeServices.DrawElement( Canvas.Handle, DE, FTracerPos);
|
||||
|
||||
DE:=ThemeServices.GetElementDetails(ttbThumbNormal);
|
||||
if FOrientation = trHorizontal then
|
||||
DE:=ThemeServices.GetElementDetails(ttbThumbNormal)
|
||||
else
|
||||
DE:=ThemeServices.GetElementDetails(ttbThumbVertNormal);
|
||||
ThemeServices.DrawElement( Canvas.Handle, DE, FSelectedPos);
|
||||
end
|
||||
else
|
||||
|
Reference in New Issue
Block a user