TAChart: Use Grid.Columns in TDataPointsEditorForm

git-svn-id: trunk@32081 -
This commit is contained in:
ask 2011-08-28 11:13:05 +00:00
parent 2e38d51e90
commit f9b4fae300
2 changed files with 52 additions and 10 deletions

View File

@ -13,9 +13,49 @@ object DataPointsEditorForm: TDataPointsEditorForm
Top = 0
Width = 357
Align = alClient
AutoFillColumns = True
Columns = <
item
Alignment = taRightJustify
Title.Alignment = taCenter
Title.Caption = 'X'
Title.Font.Style = [fsBold]
Title.PrefixOption = poNone
Width = 72
end
item
Alignment = taRightJustify
Title.Alignment = taCenter
Title.Caption = 'Y'
Title.Font.Style = [fsBold]
Title.PrefixOption = poNone
Width = 72
end
item
Title.Alignment = taCenter
Title.Caption = 'Color'
Title.Font.Style = [fsBold]
Title.PrefixOption = poNone
Width = 72
end
item
Title.Alignment = taCenter
Title.Caption = 'Text'
Title.Font.Style = [fsBold]
Title.PrefixOption = poNone
Width = 73
end>
DefaultColWidth = 32
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goColSizing, goRowMoving, goEditing, goAutoAddRows, goRowSelect, goAlwaysShowEditor, goSmoothScroll, goFixedRowNumbering]
PopupMenu = pmRows
TabOrder = 0
ColWidths = (
32
72
72
72
73
)
end
object ButtonPanel1: TButtonPanel
Left = 6

View File

@ -82,15 +82,18 @@ var
begin
FYCount := AYCount;
FDataPoints := ADataPoints;
sgData.ColCount := AYCount + 4;
sgData.RowCount := Max(ADataPoints.Count + 1, 2);
sgData.Cells[0, 0] := 'No.';
sgData.Cells[1, 0] := 'X';
sgData.Cells[2, 0] := 'Y';
for i := 2 to AYCount do
sgData.Cells[i + 1, 0] := 'Y' + IntToStr(i);
sgData.Cells[AYCount + 2, 0] := 'Color';
sgData.Cells[AYCount + 3, 0] := 'Text';
for i := sgData.Columns.Count - 1 downto 0 do
with sgData.Columns[i].Title do
if (Caption[1] = 'Y') and (Caption <> 'Y') then
sgData.Columns.Delete(i);
for i := 2 to AYCount do begin
with sgData.Columns.Add do begin
Assign(sgData.Columns[1]);
Title.Caption := 'Y' + IntToStr(i);
Index := i;
end;
end;
for i := 0 to ADataPoints.Count - 1 do
with sgData.Rows[i + 1] do begin
Delimiter := '|';
@ -105,10 +108,9 @@ begin
sgData.Rows[1].Clear;
exit;
end;
if InRange(FCurrentRow, 1, sgData.RowCount - 1) then begin
if InRange(FCurrentRow, 1, sgData.RowCount - 1) then
sgData.DeleteRow(FCurrentRow);
end;
end;
procedure TDataPointsEditorForm.miInsertRowClick(Sender: TObject);
begin