Merged revision(s) 62451 #7b571df356 from trunk:

TAChart: Improved and scaled layout of TChartListbox demo.
........

git-svn-id: branches/fixes_2_0@62616 -
This commit is contained in:
maxim 2020-02-07 22:10:15 +00:00
parent 1b233c929f
commit 4f57011244
4 changed files with 194 additions and 129 deletions

View File

@ -3,40 +3,52 @@ object Form1: TForm1
Height = 419 Height = 419
Top = 182 Top = 182
Width = 892 Width = 892
Caption = 'Form1' Caption = 'TChartListbox demo'
ClientHeight = 419 ClientHeight = 419
ClientWidth = 892 ClientWidth = 892
OnCreate = FormCreate OnCreate = FormCreate
LCLVersion = '0.9.31' LCLVersion = '2.1.0.0'
object Chart: TChart object Chart: TChart
Left = 296 Left = 292
Height = 419 Height = 419
Top = 0 Top = 0
Width = 453 Width = 457
AxisList = < AxisList = <
item item
Grid.Color = clSilver
Grid.Style = psSolid
Intervals.MaxLength = 100
Marks.LabelBrush.Style = bsClear
Minors = < Minors = <
item item
Grid.Color = clSilver Grid.Color = clSilver
Intervals.MinLength = 5 Intervals.MinLength = 5
Intervals.Options = [aipUseCount, aipUseMinLength] Intervals.Options = [aipUseCount, aipUseMinLength]
Marks.LabelBrush.Style = bsClear
end> end>
Title.LabelFont.Orientation = 900 Title.LabelFont.Orientation = 900
Title.LabelFont.Style = [fsBold] Title.LabelFont.Style = [fsBold]
Title.Visible = True Title.Visible = True
Title.Caption = 'y axis' Title.Caption = 'y axis'
Title.LabelBrush.Style = bsClear
end end
item item
Grid.Color = clSilver
Grid.Style = psSolid
Intervals.MaxLength = 100
Alignment = calBottom Alignment = calBottom
Marks.LabelBrush.Style = bsClear
Minors = < Minors = <
item item
Grid.Color = clSilver Grid.Color = clSilver
Intervals.MinLength = 5 Intervals.MinLength = 5
Intervals.Options = [aipUseCount, aipUseMinLength] Intervals.Options = [aipUseCount, aipUseMinLength]
Marks.LabelBrush.Style = bsClear
end> end>
Title.LabelFont.Style = [fsBold] Title.LabelFont.Style = [fsBold]
Title.Visible = True Title.Visible = True
Title.Caption = 'x axis' Title.Caption = 'x axis'
Title.LabelBrush.Style = bsClear
end> end>
BackColor = clWhite BackColor = clWhite
Foot.Brush.Color = clBtnFace Foot.Brush.Color = clBtnFace
@ -48,7 +60,6 @@ object Form1: TForm1
) )
Align = alClient Align = alClient
DoubleBuffered = True DoubleBuffered = True
ParentColor = False
object SinSeries: TLineSeries object SinSeries: TLineSeries
Title = 'sin(x)' Title = 'sin(x)'
LinePen.Color = clRed LinePen.Color = clRed
@ -68,47 +79,11 @@ object Form1: TForm1
ClientHeight = 419 ClientHeight = 419
ClientWidth = 138 ClientWidth = 138
TabOrder = 1 TabOrder = 1
object CheckListBox1: TCheckListBox
Left = 0
Height = 83
Top = 336
Width = 138
Align = alBottom
Items.Strings = (
'Item1'
'Item2'
'Item3'
'Item4'
'Item5'
)
ItemHeight = 15
TabOrder = 0
Data = {
050000000000000000
}
end
object ListBox1: TListBox
Left = 0
Height = 80
Top = 256
Width = 138
Align = alBottom
Items.Strings = (
'Item1'
'Item2'
'Item3'
'Item4'
'Item5'
'Item6'
)
ItemHeight = 13
TabOrder = 1
end
object ChartListbox: TChartListbox object ChartListbox: TChartListbox
Left = 0 Left = 6
Height = 256 Height = 407
Top = 0 Top = 6
Width = 138 Width = 126
Chart = Chart Chart = Chart
OnAddSeries = ChartListboxAddSeries OnAddSeries = ChartListboxAddSeries
OnCheckboxClick = ChartListboxCheckboxClick OnCheckboxClick = ChartListboxCheckboxClick
@ -116,9 +91,10 @@ object Form1: TForm1
OnPopulate = ChartListboxPopulate OnPopulate = ChartListboxPopulate
OnSeriesIconDblClick = ChartListboxSeriesIconDblClick OnSeriesIconDblClick = ChartListboxSeriesIconDblClick
Align = alClient Align = alClient
BorderSpacing.Around = 6
Color = clInfoBk Color = clInfoBk
ItemHeight = 20 ItemHeight = 20
TabOrder = 2 TabOrder = 0
end end
end end
object Splitter: TSplitter object Splitter: TSplitter
@ -133,54 +109,87 @@ object Form1: TForm1
Left = 0 Left = 0
Height = 419 Height = 419
Top = 0 Top = 0
Width = 296 Width = 292
Align = alLeft Align = alLeft
AutoSize = True
BevelInner = bvRaised BevelInner = bvRaised
BevelOuter = bvLowered BevelOuter = bvLowered
ClientHeight = 419 ClientHeight = 419
ClientWidth = 296 ClientWidth = 292
TabOrder = 3 TabOrder = 3
object BtnAddSeries: TButton object BtnAddSeries: TButton
AnchorSideLeft.Control = Panel1
AnchorSideTop.Control = Panel1
AnchorSideRight.Control = BtnDeleteSeries
AnchorSideRight.Side = asrBottom
Left = 8 Left = 8
Height = 25 Height = 25
Top = 12 Top = 8
Width = 81 Width = 91
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Top = 6
Caption = 'Add series' Caption = 'Add series'
OnClick = BtnAddSeriesClick OnClick = BtnAddSeriesClick
TabOrder = 0 TabOrder = 0
end end
object BtnToggleCOS: TButton object BtnToggleCOS: TButton
Left = 104 AnchorSideLeft.Control = BtnDeleteSeries
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = BtnDeleteSeries
AnchorSideRight.Control = BtnToggleSIN
AnchorSideRight.Side = asrBottom
Left = 105
Height = 25 Height = 25
Top = 40 Top = 39
Width = 81 Width = 94
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Left = 6
Caption = 'Toggle cos(x)' Caption = 'Toggle cos(x)'
OnClick = BtnToggleCOSClick OnClick = BtnToggleCOSClick
TabOrder = 1 TabOrder = 1
end end
object BtnToggleChart: TButton object BtnToggleChart: TButton
Left = 9 AnchorSideLeft.Control = BtnAddSeries
AnchorSideTop.Control = Memo
AnchorSideTop.Side = asrBottom
AnchorSideBottom.Control = CbShowCheckboxes
Left = 8
Height = 25 Height = 25
Top = 232 Top = 269
Width = 159 Width = 164
Anchors = [akLeft, akBottom]
AutoSize = True
BorderSpacing.Bottom = 16
Caption = 'Toggle ChartListbox.Chart' Caption = 'Toggle ChartListbox.Chart'
OnClick = BtnToggleChartClick OnClick = BtnToggleChartClick
TabOrder = 2 TabOrder = 2
end end
object BtnToggleSIN: TButton object BtnToggleSIN: TButton
Left = 104 AnchorSideLeft.Control = BtnAddSeries
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = BtnAddSeries
Left = 105
Height = 25 Height = 25
Top = 12 Top = 8
Width = 82 Width = 94
AutoSize = True
BorderSpacing.Left = 6
Caption = 'Toggle sin(x)' Caption = 'Toggle sin(x)'
OnClick = BtnToggleSINClick OnClick = BtnToggleSINClick
TabOrder = 3 TabOrder = 3
end end
object CbShowCheckboxes: TCheckBox object CbShowCheckboxes: TCheckBox
Left = 9 AnchorSideLeft.Control = Panel1
Height = 17 AnchorSideBottom.Control = CbCheckStyle
Top = 280 Left = 8
Width = 105 Height = 19
Top = 310
Width = 114
Anchors = [akLeft, akBottom]
BorderSpacing.Left = 6
BorderSpacing.Bottom = 12
Caption = 'Show checkboxes' Caption = 'Show checkboxes'
Checked = True Checked = True
OnChange = CbShowCheckboxesChange OnChange = CbShowCheckboxesChange
@ -188,10 +197,13 @@ object Form1: TForm1
TabOrder = 4 TabOrder = 4
end end
object CbShowSeriesIcon: TCheckBox object CbShowSeriesIcon: TCheckBox
Left = 152 AnchorSideLeft.Control = Bevel2
Height = 17 AnchorSideLeft.Side = asrBottom
Top = 280 AnchorSideTop.Control = CbShowCheckboxes
Width = 104 Left = 151
Height = 19
Top = 310
Width = 112
Caption = 'Show series icons' Caption = 'Show series icons'
Checked = True Checked = True
OnChange = CbShowSeriesIconChange OnChange = CbShowSeriesIconChange
@ -199,82 +211,148 @@ object Form1: TForm1
TabOrder = 5 TabOrder = 5
end end
object CbCheckStyle: TCheckBox object CbCheckStyle: TCheckBox
AnchorSideLeft.Control = Panel1
AnchorSideBottom.Control = CbKeepSeriesOut
Left = 8 Left = 8
Height = 17 Height = 19
Top = 312 Top = 341
Width = 84 Width = 91
Anchors = [akLeft, akBottom]
BorderSpacing.Left = 6
BorderSpacing.Bottom = 32
Caption = 'Radiobuttons' Caption = 'Radiobuttons'
OnChange = CbCheckStyleChange OnChange = CbCheckStyleChange
TabOrder = 6 TabOrder = 6
end end
object Memo: TMemo object Memo: TMemo
Left = 9 AnchorSideLeft.Control = Panel1
Height = 106 AnchorSideTop.Control = Label1
Top = 104 AnchorSideTop.Side = asrBottom
Width = 275 AnchorSideRight.Control = Panel1
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = BtnToggleChart
Left = 8
Height = 160
Top = 103
Width = 276
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 6
BorderSpacing.Top = 2
BorderSpacing.Right = 6
BorderSpacing.Bottom = 6
ScrollBars = ssAutoVertical ScrollBars = ssAutoVertical
TabOrder = 7 TabOrder = 7
end end
object Label1: TLabel object Label1: TLabel
Left = 9 AnchorSideLeft.Control = BtnAddSeries
Height = 14 AnchorSideTop.Control = Bevel1
Top = 88 AnchorSideTop.Side = asrBottom
Width = 57 Left = 8
Height = 15
Top = 86
Width = 63
BorderSpacing.Top = 6
Caption = 'Click viewer' Caption = 'Click viewer'
ParentColor = False ParentColor = False
end end
object EdColumns: TSpinEdit object EdColumns: TSpinEdit
Left = 208 AnchorSideLeft.Control = Label2
Height = 21 AnchorSideLeft.Side = asrBottom
Top = 308 AnchorSideTop.Control = Label2
Width = 50 AnchorSideTop.Side = asrCenter
Left = 206
Height = 23
Top = 339
Width = 60
Alignment = taRightJustify
BorderSpacing.Left = 4
MinValue = 1 MinValue = 1
OnChange = EdColumnsChange OnChange = EdColumnsChange
TabOrder = 8 TabOrder = 8
Value = 1 Value = 1
end end
object Label2: TLabel object Label2: TLabel
Left = 152 AnchorSideLeft.Control = Bevel2
Height = 14 AnchorSideLeft.Side = asrBottom
Top = 313 AnchorSideTop.Control = CbCheckStyle
Width = 45 AnchorSideTop.Side = asrCenter
Left = 151
Height = 15
Top = 343
Width = 51
Caption = 'Columns:' Caption = 'Columns:'
ParentColor = False ParentColor = False
end end
object BtnDeleteSeries: TButton object BtnDeleteSeries: TButton
Left = 9 AnchorSideLeft.Control = Panel1
AnchorSideTop.Control = BtnAddSeries
AnchorSideTop.Side = asrBottom
Left = 8
Height = 25 Height = 25
Top = 40 Top = 39
Width = 81 Width = 91
AutoSize = True
BorderSpacing.Left = 6
BorderSpacing.Top = 6
Caption = 'Delete series' Caption = 'Delete series'
OnClick = BtnDeleteSeriesClick OnClick = BtnDeleteSeriesClick
TabOrder = 9 TabOrder = 9
end end
object CbKeepSeriesOut: TCheckBox object CbKeepSeriesOut: TCheckBox
Left = 9 AnchorSideLeft.Control = Panel1
Height = 17 AnchorSideBottom.Control = Panel1
Top = 376 AnchorSideBottom.Side = asrBottom
Width = 227 Left = 8
Height = 19
Top = 392
Width = 245
Anchors = [akLeft, akBottom]
BorderSpacing.Left = 6
BorderSpacing.Bottom = 6
Caption = 'Keep sin and cos series out of ChartListBox' Caption = 'Keep sin and cos series out of ChartListBox'
OnChange = CbKeepSeriesOutChange OnChange = CbKeepSeriesOutChange
TabOrder = 10 TabOrder = 10
end end
object Bevel1: TBevel object Bevel1: TBevel
Left = 9 AnchorSideLeft.Control = Panel1
AnchorSideTop.Control = BtnDeleteSeries
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Panel1
AnchorSideRight.Side = asrBottom
Left = 8
Height = 4 Height = 4
Top = 76 Top = 76
Width = 278 Width = 276
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Top = 12
BorderSpacing.Right = 6
Shape = bsBottomLine Shape = bsBottomLine
end end
object BtnAddPoint: TButton object BtnAddPoint: TButton
Left = 209 AnchorSideLeft.Control = BtnToggleSIN
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = BtnAddSeries
Left = 205
Height = 25 Height = 25
Top = 12 Top = 8
Width = 75 Width = 79
AutoSize = True
BorderSpacing.Left = 6
BorderSpacing.Right = 6
Caption = 'Add point' Caption = 'Add point'
OnClick = BtnAddPointClick OnClick = BtnAddPointClick
TabOrder = 11 TabOrder = 11
end end
object Bevel2: TBevel
AnchorSideLeft.Control = Panel1
AnchorSideLeft.Side = asrCenter
Left = 141
Height = 72
Top = 304
Width = 10
Shape = bsSpacer
end
end end
object RandomChartSource: TRandomChartSource object RandomChartSource: TRandomChartSource
PointsNumber = 10 PointsNumber = 10

View File

@ -15,6 +15,7 @@ type
TForm1 = class(TForm) TForm1 = class(TForm)
Bevel1: TBevel; Bevel1: TBevel;
Bevel2: TBevel;
BtnAddSeries: TButton; BtnAddSeries: TButton;
BtnDeleteSeries: TButton; BtnDeleteSeries: TButton;
BtnToggleCOS: TButton; BtnToggleCOS: TButton;
@ -27,11 +28,9 @@ type
CbCheckStyle: TCheckBox; CbCheckStyle: TCheckBox;
CbKeepSeriesOut: TCheckBox; CbKeepSeriesOut: TCheckBox;
ChartListbox: TChartListbox; ChartListbox: TChartListbox;
CheckListBox1: TCheckListBox;
ColorDialog: TColorDialog; ColorDialog: TColorDialog;
Label1: TLabel; Label1: TLabel;
Label2: TLabel; Label2: TLabel;
ListBox1: TListBox;
Memo: TMemo; Memo: TMemo;
SinSeries: TLineSeries; SinSeries: TLineSeries;
CosSeries: TLineSeries; CosSeries: TLineSeries;
@ -186,8 +185,6 @@ end;
procedure TForm1.EdColumnsChange(Sender: TObject); procedure TForm1.EdColumnsChange(Sender: TObject);
begin begin
ChartListbox.Columns := EdColumns.Value; ChartListbox.Columns := EdColumns.Value;
CheckListbox1.Columns := EdColumns.Value;
Listbox1.Columns := EdColumns.Value;
end; end;
procedure TForm1.BtnAddSeriesClick(Sender: TObject); procedure TForm1.BtnAddSeriesClick(Sender: TObject);

View File

@ -1,32 +1,34 @@
<?xml version="1.0"?> <?xml version="1.0" encoding="UTF-8"?>
<CONFIG> <CONFIG>
<ProjectOptions> <ProjectOptions>
<Version Value="9"/> <Version Value="12"/>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<General> <General>
<Flags>
<CompatibilityMode Value="True"/>
</Flags>
<SessionStorage Value="InProjectDir"/> <SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/> <Scaled Value="True"/>
<ResourceType Value="res"/> <ResourceType Value="res"/>
<UseXPManifest Value="True"/> <UseXPManifest Value="True"/>
<XPManifest>
<DpiAware Value="True"/>
</XPManifest>
</General> </General>
<i18n> <i18n>
<EnableI18N LFM="False"/> <EnableI18N LFM="False"/>
</i18n> </i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1"> <BuildModes Count="1">
<Item1 Name="Default" Default="True"/> <Item1 Name="Default" Default="True"/>
</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>
<local> <FormatVersion Value="2"/>
<FormatVersion Value="1"/> <Modes Count="1">
</local> <Mode0 Name="default"/>
</Modes>
</RunParams> </RunParams>
<RequiredPackages Count="2"> <RequiredPackages Count="2">
<Item1> <Item1>
@ -36,24 +38,18 @@
<PackageName Value="LCL"/> <PackageName Value="LCL"/>
</Item2> </Item2>
</RequiredPackages> </RequiredPackages>
<Units Count="3"> <Units Count="2">
<Unit0> <Unit0>
<Filename Value="listboxdemo.lpr"/> <Filename Value="listboxdemo.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="listboxdemo"/>
</Unit0> </Unit0>
<Unit1> <Unit1>
<Filename Value="Unit1.pas"/> <Filename Value="Unit1.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/> <ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="Unit1"/>
</Unit1> </Unit1>
<Unit2>
<Filename Value="..\TAChartListbox.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="TAChartListbox"/>
</Unit2>
</Units> </Units>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>
@ -61,7 +57,6 @@
<PathDelim Value="\"/> <PathDelim Value="\"/>
<SearchPaths> <SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/> <IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value=".."/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<Linking> <Linking>
@ -74,12 +69,6 @@
</Win32> </Win32>
</Options> </Options>
</Linking> </Linking>
<Other>
<CompilerMessages>
<UseMsgFile Value="True"/>
</CompilerMessages>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions> </CompilerOptions>
<Debugging> <Debugging>
<Exceptions Count="3"> <Exceptions Count="3">

View File

@ -7,12 +7,13 @@ uses
cthreads, cthreads,
{$ENDIF}{$ENDIF} {$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset Interfaces, // this includes the LCL widgetset
Forms, tachartlazaruspkg, Unit1, TAChartListbox; Forms, tachartlazaruspkg, Unit1;
{$R *.res} {$R *.res}
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;