You've already forked lazarus-ccr
jvcllaz: ReadOnly support in TJvYearGrid. YearGridEditForm contains a color box for color selection. Extended YearGrid demo.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8374 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -62,6 +62,7 @@
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<DebugInfoType Value="dsDwarf3"/>
|
||||
<UseExternalDbgSyms Value="True"/>
|
||||
</Debugging>
|
||||
<Options>
|
||||
|
@ -16,6 +16,7 @@ begin
|
||||
{$IF LCL_FULLVERSION >= 1080000}
|
||||
Application.Scaled := True;
|
||||
{$ENDIF}
|
||||
Application.Scaled:=True;
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TMainForm, MainForm);
|
||||
Application.Run;
|
||||
|
@ -1,15 +1,14 @@
|
||||
object MainForm: TMainForm
|
||||
Left = 361
|
||||
Height = 546
|
||||
Height = 399
|
||||
Top = 215
|
||||
Width = 1310
|
||||
Width = 911
|
||||
AutoSize = True
|
||||
Caption = 'JvYearGrid Demo'
|
||||
ClientHeight = 546
|
||||
ClientWidth = 1310
|
||||
ClientHeight = 399
|
||||
ClientWidth = 911
|
||||
OnActivate = FormActivate
|
||||
OnCreate = FormCreate
|
||||
LCLVersion = '2.1.0.0'
|
||||
object JvYearGrid1: TJvYearGrid
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = Owner
|
||||
@ -98,14 +97,14 @@ object MainForm: TMainForm
|
||||
AnchorSideTop.Control = JvYearGrid1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 89
|
||||
Height = 119
|
||||
Top = 264
|
||||
Width = 905
|
||||
Width = 911
|
||||
AutoSize = True
|
||||
BorderSpacing.Bottom = 16
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 89
|
||||
ClientWidth = 905
|
||||
ClientHeight = 119
|
||||
ClientWidth = 911
|
||||
ParentFont = False
|
||||
TabOrder = 1
|
||||
object edLeftMargin: TSpinEdit
|
||||
@ -190,6 +189,7 @@ object MainForm: TMainForm
|
||||
Width = 156
|
||||
Anchors = [akTop, akRight]
|
||||
Caption = 'Day names alignment/format'
|
||||
Color = clDefault
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
end
|
||||
@ -206,6 +206,7 @@ object MainForm: TMainForm
|
||||
Width = 172
|
||||
BorderSpacing.Left = 32
|
||||
Caption = 'Month names alignment/format'
|
||||
Color = clDefault
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
end
|
||||
@ -243,6 +244,7 @@ object MainForm: TMainForm
|
||||
Width = 82
|
||||
Anchors = [akTop, akRight]
|
||||
Caption = 'Days alignment'
|
||||
Color = clDefault
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
end
|
||||
@ -276,7 +278,7 @@ object MainForm: TMainForm
|
||||
Left = 506
|
||||
Height = 19
|
||||
Top = 56
|
||||
Width = 39
|
||||
Width = 37
|
||||
BorderSpacing.Right = 16
|
||||
Caption = 'Flat'
|
||||
OnChange = cmbFlatChange
|
||||
@ -290,7 +292,7 @@ object MainForm: TMainForm
|
||||
Left = 506
|
||||
Height = 23
|
||||
Top = 0
|
||||
Width = 100
|
||||
Width = 106
|
||||
BorderSpacing.Left = 8
|
||||
ItemHeight = 15
|
||||
Items.Strings = (
|
||||
@ -310,7 +312,7 @@ object MainForm: TMainForm
|
||||
Left = 506
|
||||
Height = 23
|
||||
Top = 27
|
||||
Width = 100
|
||||
Width = 106
|
||||
BorderSpacing.Left = 8
|
||||
ItemHeight = 15
|
||||
Items.Strings = (
|
||||
@ -328,7 +330,7 @@ object MainForm: TMainForm
|
||||
AnchorSideTop.Control = cmbDayFormat
|
||||
AnchorSideBottom.Control = cmbDayFormat
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 657
|
||||
Left = 663
|
||||
Height = 23
|
||||
Top = 0
|
||||
Width = 57
|
||||
@ -346,12 +348,13 @@ object MainForm: TMainForm
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = cmbDayFormat
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 632
|
||||
Left = 638
|
||||
Height = 15
|
||||
Top = 4
|
||||
Width = 22
|
||||
BorderSpacing.Left = 26
|
||||
Caption = 'Year'
|
||||
Color = clDefault
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
end
|
||||
@ -365,6 +368,7 @@ object MainForm: TMainForm
|
||||
Width = 66
|
||||
BorderSpacing.Left = 8
|
||||
Caption = 'Cell margins'
|
||||
Color = clDefault
|
||||
ParentColor = False
|
||||
end
|
||||
object btnFont: TButton
|
||||
@ -373,7 +377,7 @@ object MainForm: TMainForm
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = udYear
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 632
|
||||
Left = 638
|
||||
Height = 25
|
||||
Top = 53
|
||||
Width = 82
|
||||
@ -387,8 +391,8 @@ object MainForm: TMainForm
|
||||
AnchorSideLeft.Control = udYear
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = edTopMargin
|
||||
Left = 730
|
||||
Height = 89
|
||||
Left = 736
|
||||
Height = 81
|
||||
Top = 0
|
||||
Width = 167
|
||||
AutoFill = True
|
||||
@ -397,14 +401,15 @@ object MainForm: TMainForm
|
||||
BorderSpacing.Right = 8
|
||||
Caption = 'Auto size'
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
ChildSizing.TopBottomSpacing = 6
|
||||
ChildSizing.TopBottomSpacing = 2
|
||||
ChildSizing.HorizontalSpacing = 4
|
||||
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||
ChildSizing.EnlargeVertical = crsHomogenousChildResize
|
||||
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 2
|
||||
ClientHeight = 69
|
||||
ClientHeight = 61
|
||||
ClientWidth = 163
|
||||
Columns = 2
|
||||
Items.Strings = (
|
||||
@ -424,21 +429,57 @@ object MainForm: TMainForm
|
||||
AnchorSideTop.Control = rgAutoSize
|
||||
AnchorSideRight.Control = rgAutoSize
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 877
|
||||
Height = 19
|
||||
Left = 885
|
||||
Height = 17
|
||||
Top = 0
|
||||
Width = 20
|
||||
Width = 18
|
||||
Anchors = [akTop, akRight]
|
||||
Checked = True
|
||||
OnChange = cmbAutoSizeChange
|
||||
State = cbChecked
|
||||
TabOrder = 13
|
||||
end
|
||||
object cbReadOnly: TCheckBox
|
||||
AnchorSideLeft.Control = cmbFlat
|
||||
AnchorSideTop.Control = cmbFlat
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 506
|
||||
Height = 19
|
||||
Top = 75
|
||||
Width = 72
|
||||
Caption = 'Read-only'
|
||||
TabOrder = 14
|
||||
end
|
||||
object btnSaveYear: TButton
|
||||
AnchorSideLeft.Control = Label2
|
||||
AnchorSideTop.Control = cbReadOnly
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 218
|
||||
Height = 25
|
||||
Top = 94
|
||||
Width = 75
|
||||
Caption = 'Save year'
|
||||
OnClick = btnSaveYearClick
|
||||
TabOrder = 15
|
||||
end
|
||||
object btnLoadYear: TButton
|
||||
AnchorSideLeft.Control = btnSaveYear
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = btnSaveYear
|
||||
Left = 299
|
||||
Height = 25
|
||||
Top = 94
|
||||
Width = 75
|
||||
BorderSpacing.Left = 6
|
||||
Caption = 'Load year'
|
||||
OnClick = btnLoadYearClick
|
||||
TabOrder = 16
|
||||
end
|
||||
end
|
||||
object FontDialog1: TFontDialog
|
||||
MinFontSize = 0
|
||||
MaxFontSize = 0
|
||||
left = 568
|
||||
top = 320
|
||||
Left = 688
|
||||
Top = 296
|
||||
end
|
||||
end
|
||||
|
@ -15,6 +15,9 @@ type
|
||||
|
||||
TMainForm = class(TForm)
|
||||
btnFont: TButton;
|
||||
btnSaveYear: TButton;
|
||||
btnLoadYear: TButton;
|
||||
cbReadOnly: TCheckBox;
|
||||
cmbAutoSize: TCheckBox;
|
||||
cmbMonthFormat: TComboBox;
|
||||
cmbDayNamesAlignment: TComboBox;
|
||||
@ -37,6 +40,8 @@ type
|
||||
rgAutoSize: TCheckGroup;
|
||||
udYear: TUpDown;
|
||||
procedure btnFontClick(Sender: TObject);
|
||||
procedure btnLoadYearClick(Sender: TObject);
|
||||
procedure btnSaveYearClick(Sender: TObject);
|
||||
procedure cmbAutoSizeChange(Sender: TObject);
|
||||
procedure cmbDayFormatChange(Sender: TObject);
|
||||
procedure cmbDayNamesAlignmentChange(Sender: TObject);
|
||||
@ -89,6 +94,23 @@ begin
|
||||
JvYearGrid1.Font.Assign(FontDialog1.Font);
|
||||
end;
|
||||
|
||||
procedure TMainForm.btnLoadYearClick(Sender: TObject);
|
||||
var
|
||||
fn: String;
|
||||
begin
|
||||
fn := Application.Location + IntToStr(JvYearGrid1.Year) + '.dat';
|
||||
if FileExists(fn) then
|
||||
JvYearGrid1.LoadYear(fn);
|
||||
end;
|
||||
|
||||
procedure TMainForm.btnSaveYearClick(Sender: TObject);
|
||||
var
|
||||
fn: String;
|
||||
begin
|
||||
fn := Application.Location + IntToStr(JvYearGrid1.Year) + '.dat';
|
||||
JvYearGrid1.SaveYear(fn);
|
||||
end;
|
||||
|
||||
procedure TMainForm.cmbAutoSizeChange(Sender: TObject);
|
||||
begin
|
||||
JvYearGrid1.AutoSize := cmbAutoSize.Checked;
|
||||
|
@ -81,6 +81,7 @@ type
|
||||
FAutoSize: Boolean;
|
||||
FDayFormat: TJvDayFormat;
|
||||
FMonthFormat: TJvMonthFormat;
|
||||
FReadOnly: Boolean;
|
||||
FOnInfoChanging: TOnInfoChanging;
|
||||
FOnSelectDate: TOnSelectDate;
|
||||
FOnYearChanged: TOnYearChanged;
|
||||
@ -118,6 +119,7 @@ type
|
||||
procedure SetMonthFormat(const AValue: TJvMonthFormat);
|
||||
procedure SetMonthNamesAlignment(const Value: TAlignment);
|
||||
procedure SetOrientation(const Value: TJvYearGridOrientation);
|
||||
procedure SetReadOnly(const Value: Boolean);
|
||||
procedure SetWeekendColor(const AValue: TColor);
|
||||
procedure SetWeekendDays(const Value: TJvWeekDaySet);
|
||||
procedure SetYear(const Value: Integer);
|
||||
@ -233,6 +235,7 @@ type
|
||||
property WeekendColor: TColor read FWeekendColor write SetWeekendColor default JvDefaultWeekendColor;
|
||||
property Orientation: TJvYearGridOrientation read FOrientation write SetOrientation default yoHorizontal;
|
||||
property FirstDayOfWeek: TJvWeekDay read FFirstDayOfWeek write SetFirstDayOfWeek default wdMonday;
|
||||
property ReadOnly: Boolean read FReadOnly write SetReadOnly default false;
|
||||
|
||||
property Year: Integer read FYear write SetYear;
|
||||
property YearFile: string read FYearFile write FYearFile;
|
||||
@ -283,6 +286,7 @@ uses
|
||||
const
|
||||
TodayFontColor = clWhite;
|
||||
TodayBrushColor = clRed;
|
||||
READONLY_TAG = 2;
|
||||
|
||||
constructor TJvYearGrid.Create(AOwner: TComponent);
|
||||
var
|
||||
@ -487,7 +491,7 @@ begin
|
||||
DList.Clear;
|
||||
DList.Append(FYearData[DayIndex, MonthIndex].DisplayText);
|
||||
S := FYearData[DayIndex, MonthIndex].InfoText;
|
||||
S := StringReplace(S, Cr, '||', [rfReplaceAll]);
|
||||
S := StringReplace(S, LineEnding, '||', [rfReplaceAll]);
|
||||
DList.Append(S);
|
||||
DList.Append(ColorToString(FYearData[DayIndex, MonthIndex].DefaultColor));
|
||||
DList.Append(ColorToString(FYearData[DayIndex, MonthIndex].CustomColor));
|
||||
@ -532,7 +536,7 @@ begin
|
||||
Inc(Index);
|
||||
FYearData[DayIndex, MonthIndex].DisplayText := DList[0];
|
||||
S := DList[1];
|
||||
S := StringReplace(S, '||', Cr, [rfReplaceAll]);
|
||||
S := StringReplace(S, '||', LineEnding, [rfReplaceAll]);
|
||||
FYearData[DayIndex, MonthIndex].InfoText := S;
|
||||
FYearData[DayIndex, MonthIndex].DefaultColor := StringToColor(DList[2]);
|
||||
FYearData[DayIndex, MonthIndex].CustomColor := StringToColor(DList[3]);
|
||||
@ -718,8 +722,12 @@ procedure TJvYearGrid.mnuYearClick(Sender: TObject);
|
||||
var
|
||||
S: string;
|
||||
AYear: Word;
|
||||
n: Integer;
|
||||
begin
|
||||
n := cInputQueryEditSizePercents;
|
||||
cInputQueryEditSizePercents := 0;
|
||||
S := InputBox(RsYearGrid, RsEnterYear, IntToStr(Self.Year));
|
||||
cInputQueryEditSizePercents := n;
|
||||
try
|
||||
if S = '' then
|
||||
Exit;
|
||||
@ -736,6 +744,8 @@ procedure TJvYearGrid.mnuPasteClick(Sender: TObject);
|
||||
var
|
||||
S: string = '';
|
||||
begin
|
||||
if FReadOnly then
|
||||
exit;
|
||||
if GetCellData(S) then
|
||||
if Clipboard.HasFormat(CF_TEXT) then
|
||||
SetCellData(Clipboard.AsText);
|
||||
@ -745,6 +755,8 @@ procedure TJvYearGrid.mnuDeleteClick(Sender: TObject);
|
||||
var
|
||||
S: string = '';
|
||||
begin
|
||||
if FReadOnly then
|
||||
exit;
|
||||
if GetCellData(S) then
|
||||
SetCellData('');
|
||||
end;
|
||||
@ -846,6 +858,9 @@ var
|
||||
CanChange: Boolean;
|
||||
InfoText: string;
|
||||
begin
|
||||
if FReadOnly then
|
||||
exit;
|
||||
|
||||
lCol := Col;
|
||||
lRow := Row;
|
||||
if (lCol < 1) or (lRow < 1) then
|
||||
@ -858,6 +873,7 @@ begin
|
||||
InfoText := FYearData[lCol, lRow].InfoText;
|
||||
F.MemoText.Text := InfoText;
|
||||
F.Caption := 'Edit ' + DateToStr(CellToDate(lCol, lRow));
|
||||
F.ColorBox.Selected := FYearData[lCol, lRow].CustomColor;
|
||||
if F.ShowModal = mrOk then
|
||||
begin
|
||||
InfoText := F.MemoText.Text;
|
||||
@ -870,10 +886,10 @@ begin
|
||||
if InfoText = '' then
|
||||
FYearData[lCol, lRow].Custom := False
|
||||
else
|
||||
if not FYearData[lCol, lRow].Custom then
|
||||
// if not FYearData[lCol, lRow].Custom then
|
||||
begin
|
||||
FYearData[lCol, lRow].Custom := True;
|
||||
FYearData[lCol, lRow].CustomColor := RGB(206, 250, 253);
|
||||
FYearData[lCol, lRow].CustomColor := F.ColorBox.Selected;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@ -886,7 +902,7 @@ procedure TJvYearGrid.mnuColorClick(Sender: TObject);
|
||||
var
|
||||
CD: TColorDialog;
|
||||
begin
|
||||
if (Col < 1) or (Row < 1) or (FYearData[Col, Row].DisplayText = '') then
|
||||
if (Col < 1) or (Row < 1) or (FYearData[Col, Row].DisplayText = '') or FReadOnly then
|
||||
Exit;
|
||||
CD := TColorDialog.Create(Application);
|
||||
{ -- not available in LCL:
|
||||
@ -903,7 +919,7 @@ end;
|
||||
|
||||
procedure TJvYearGrid.mnuNoColorClick(Sender: TObject);
|
||||
begin
|
||||
if (Col < 1) or (Row < 1) or (FYearData[Col, Row].DisplayText = '') then
|
||||
if (Col < 1) or (Row < 1) or (FYearData[Col, Row].DisplayText = '') or FReadOnly then
|
||||
Exit;
|
||||
FYearData[Col, Row].Custom := False;
|
||||
Invalidate;
|
||||
@ -915,10 +931,18 @@ var
|
||||
begin
|
||||
if (Col > 0) and (Row > 0) and (FYearData[Col, Row].DisplayText <> '') then
|
||||
for I := 0 to FGridPop.Items.Count - 1 do
|
||||
FGridPop.Items[I].Enabled := True
|
||||
begin
|
||||
FGridPop.Items[I].Enabled := True;
|
||||
if (FGridPop.Items[I].Tag AND READONLY_TAG <> 0) and FReadOnly then
|
||||
FGridPop.Items[I].Enabled := False;
|
||||
end
|
||||
else
|
||||
for I := 0 to FGridPop.Items.Count - 1 do
|
||||
begin
|
||||
FGridPop.Items[I].Enabled := (FGridPop.Items[I].Tag = 1);
|
||||
if (FGridPop.Items[I].Tag AND READONLY_TAG <> 0) and FReadOnly then
|
||||
FGridPop.Items[I].Enabled := False;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJvYearGrid.Launch(AFile: string);
|
||||
@ -1467,6 +1491,15 @@ begin
|
||||
AdjustBounds;
|
||||
end;
|
||||
|
||||
procedure TJvYearGrid.SetReadOnly(const Value: Boolean);
|
||||
begin
|
||||
if Value <> FReadOnly then
|
||||
begin
|
||||
FReadOnly := Value;
|
||||
SetupGridPop(self);
|
||||
end;
|
||||
end;
|
||||
|
||||
function TJvYearGrid.IsCurrentYear: Boolean;
|
||||
begin
|
||||
Result := Year = FCurrentYear;
|
||||
|
@ -1,81 +1,79 @@
|
||||
object YearGridEditForm: TYearGridEditForm
|
||||
Left = 303
|
||||
Height = 367
|
||||
Height = 246
|
||||
Top = 154
|
||||
Width = 394
|
||||
BorderStyle = bsDialog
|
||||
Caption = 'YearGrid Edit'
|
||||
ClientHeight = 367
|
||||
ClientHeight = 246
|
||||
ClientWidth = 394
|
||||
Color = clBtnFace
|
||||
Font.Color = clWindowText
|
||||
OnCreate = FormCreate
|
||||
OnShow = FormShow
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '1.9.0.0'
|
||||
object Panel1: TPanel
|
||||
Left = 0
|
||||
Height = 35
|
||||
Top = 332
|
||||
Width = 394
|
||||
Left = 6
|
||||
Height = 26
|
||||
Top = 214
|
||||
Width = 382
|
||||
Align = alBottom
|
||||
AutoSize = True
|
||||
ClientHeight = 35
|
||||
ClientWidth = 394
|
||||
TabOrder = 0
|
||||
BorderSpacing.Around = 6
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 26
|
||||
ClientWidth = 382
|
||||
TabOrder = 2
|
||||
object BtnOK: TBitBtn
|
||||
AnchorSideTop.Control = BitCancel
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = BitCancel
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 241
|
||||
Left = 232
|
||||
Height = 26
|
||||
Top = 4
|
||||
Top = 0
|
||||
Width = 62
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 16
|
||||
BorderSpacing.Right = 4
|
||||
BorderSpacing.Right = 6
|
||||
Caption = 'OK'
|
||||
Default = True
|
||||
Kind = bkOK
|
||||
ModalResult = 1
|
||||
TabOrder = 0
|
||||
TabOrder = 2
|
||||
end
|
||||
object BitCancel: TBitBtn
|
||||
AnchorSideTop.Control = Panel1
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = Panel1
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 307
|
||||
Left = 300
|
||||
Height = 26
|
||||
Top = 4
|
||||
Top = 0
|
||||
Width = 82
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Top = 4
|
||||
BorderSpacing.Right = 4
|
||||
BorderSpacing.Bottom = 4
|
||||
Cancel = True
|
||||
Caption = 'Cancel'
|
||||
Kind = bkCancel
|
||||
ModalResult = 2
|
||||
TabOrder = 1
|
||||
TabOrder = 3
|
||||
end
|
||||
object BtnLoad: TButton
|
||||
AnchorSideLeft.Control = Panel1
|
||||
AnchorSideTop.Control = BtnOK
|
||||
AnchorSideBottom.Control = BtnOK
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 5
|
||||
Left = 0
|
||||
Height = 26
|
||||
Top = 4
|
||||
Top = 0
|
||||
Width = 61
|
||||
Anchors = [akTop, akLeft, akBottom]
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 4
|
||||
Caption = '&Load...'
|
||||
OnClick = BtnLoadClick
|
||||
TabOrder = 2
|
||||
TabOrder = 0
|
||||
end
|
||||
object BtnSave: TButton
|
||||
AnchorSideLeft.Control = BtnLoad
|
||||
@ -83,9 +81,9 @@ object YearGridEditForm: TYearGridEditForm
|
||||
AnchorSideTop.Control = BtnLoad
|
||||
AnchorSideBottom.Control = BtnLoad
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 70
|
||||
Left = 65
|
||||
Height = 26
|
||||
Top = 4
|
||||
Top = 0
|
||||
Width = 59
|
||||
Anchors = [akTop, akLeft, akBottom]
|
||||
AutoSize = True
|
||||
@ -93,26 +91,68 @@ object YearGridEditForm: TYearGridEditForm
|
||||
BorderSpacing.Right = 16
|
||||
Caption = '&Save...'
|
||||
OnClick = BtnSaveClick
|
||||
TabOrder = 3
|
||||
TabOrder = 1
|
||||
end
|
||||
end
|
||||
object MemoText: TMemo
|
||||
Left = 0
|
||||
Height = 332
|
||||
Top = 0
|
||||
Width = 394
|
||||
Left = 6
|
||||
Height = 172
|
||||
Top = 36
|
||||
Width = 382
|
||||
Align = alClient
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Right = 6
|
||||
TabOrder = 1
|
||||
end
|
||||
object Panel2: TPanel
|
||||
Left = 6
|
||||
Height = 24
|
||||
Top = 6
|
||||
Width = 382
|
||||
Align = alTop
|
||||
AutoSize = True
|
||||
BorderSpacing.Around = 6
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 24
|
||||
ClientWidth = 382
|
||||
TabOrder = 0
|
||||
object ColorBox: TColorBox
|
||||
AnchorSideLeft.Control = LblColor
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = Panel2
|
||||
AnchorSideRight.Control = Panel2
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 37
|
||||
Height = 24
|
||||
Top = 0
|
||||
Width = 345
|
||||
Style = [cbStandardColors, cbExtendedColors, cbIncludeNone, cbIncludeDefault, cbPrettyNames, cbCustomColors]
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 8
|
||||
DropDownCount = 24
|
||||
ItemHeight = 16
|
||||
TabOrder = 0
|
||||
end
|
||||
object LblColor: TLabel
|
||||
AnchorSideLeft.Control = Panel2
|
||||
AnchorSideTop.Control = ColorBox
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 0
|
||||
Height = 15
|
||||
Top = 5
|
||||
Width = 29
|
||||
Caption = 'Color'
|
||||
end
|
||||
end
|
||||
object OpenDialog: TOpenDialog
|
||||
Filter = 'Text Files|*.txt|All Files|*.*'
|
||||
left = 88
|
||||
top = 104
|
||||
Left = 64
|
||||
Top = 80
|
||||
end
|
||||
object SaveDialog: TSaveDialog
|
||||
DefaultExt = '.txt'
|
||||
Filter = 'Text Files|*.txt|All Files|*.*'
|
||||
left = 120
|
||||
top = 104
|
||||
Left = 64
|
||||
Top = 136
|
||||
end
|
||||
end
|
||||
|
@ -30,13 +30,16 @@ unit JvYearGridEditForm;
|
||||
interface
|
||||
|
||||
uses
|
||||
SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Buttons, ExtCtrls;
|
||||
SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Buttons,
|
||||
ExtCtrls, ColorBox;
|
||||
|
||||
type
|
||||
|
||||
{ TYearGridEditForm }
|
||||
|
||||
TYearGridEditForm = class(TForm) //JvForm)
|
||||
ColorBox: TColorBox;
|
||||
LblColor: TLabel;
|
||||
Panel1: TPanel;
|
||||
BtnOK: TBitBtn;
|
||||
BitCancel: TBitBtn;
|
||||
@ -44,9 +47,11 @@ type
|
||||
BtnLoad: TButton;
|
||||
BtnSave: TButton;
|
||||
OpenDialog: TOpenDialog;
|
||||
Panel2: TPanel;
|
||||
SaveDialog: TSaveDialog;
|
||||
procedure BtnLoadClick(Sender: TObject);
|
||||
procedure BtnSaveClick(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
public
|
||||
end;
|
||||
@ -56,6 +61,9 @@ implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
const
|
||||
DEFAULT_COLOR = 206 + 250 shl 8 + 253 shl 16;
|
||||
|
||||
procedure TYearGridEditForm.BtnLoadClick(Sender: TObject);
|
||||
begin
|
||||
if OpenDialog.Execute then
|
||||
@ -70,10 +78,16 @@ begin
|
||||
MemoText.SetFocus;
|
||||
end;
|
||||
|
||||
procedure TYearGridEditForm.FormCreate(Sender: TObject);
|
||||
begin
|
||||
ColorBox.DefaultColorColor := DEFAULT_COLOR;
|
||||
ColorBox.Selected := DEFAULT_COLOR;
|
||||
end;
|
||||
|
||||
procedure TYearGridEditForm.FormShow(Sender: TObject);
|
||||
begin
|
||||
MemoText.SetFocus;
|
||||
end;
|
||||
|
||||
|
||||
end.
|
||||
|
||||
|
Reference in New Issue
Block a user