* Use TDateEdit instead of TDatePicker in advanced demo

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1071 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
blikblum
2009-12-17 02:02:01 +00:00
parent 0514629222
commit f9e4eb02af

View File

@ -10,7 +10,7 @@ interface
uses uses
LCLIntf, delphicompat, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, LCLIntf, delphicompat, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, VirtualTrees, ExtDlgs, Buttons, ExtCtrls, ComCtrls, StdCtrls, VirtualTrees, ExtDlgs, Buttons, ExtCtrls, ComCtrls,
MaskEdit, LCLType; MaskEdit, LCLType, EditBtn;
type type
// Describes the type of value a property tree node stores in its data property. // Describes the type of value a property tree node stores in its data property.
@ -26,9 +26,6 @@ type
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
//todo
TDateTimePicker = TComboBox;
type type
// Node data record for the the document properties treeview. // Node data record for the the document properties treeview.
PPropertyData = ^TPropertyData; PPropertyData = ^TPropertyData;
@ -179,6 +176,9 @@ type
end; end;
// Our own edit link to implement several different node editors. // Our own edit link to implement several different node editors.
{ TGridEditLink }
TGridEditLink = class(TPropertyEditLink, IVTEditLink) TGridEditLink = class(TPropertyEditLink, IVTEditLink)
public public
function EndEdit: Boolean; stdcall; function EndEdit: Boolean; stdcall;
@ -236,8 +236,9 @@ begin
CanAdvance := Shift = []; CanAdvance := Shift = [];
if FEdit is TComboBox then if FEdit is TComboBox then
CanAdvance := CanAdvance and not TComboBox(FEdit).DroppedDown; CanAdvance := CanAdvance and not TComboBox(FEdit).DroppedDown;
if FEdit is TDateTimePicker then //todo: there's no way to know if date is being edited in LCL
CanAdvance := CanAdvance and not TDateTimePicker(FEdit).DroppedDown; //if FEdit is TDateEdit then
// CanAdvance := CanAdvance and not TDateEdit(FEdit).DroppedDown;
if CanAdvance then if CanAdvance then
begin begin
@ -392,21 +393,13 @@ begin
end; end;
vtDate: vtDate:
begin begin
FEdit := TDateTimePicker.Create(nil); FEdit := TDateEdit.Create(nil);
with FEdit as TDateTimePicker do with FEdit as TDateEdit do
begin begin
Visible := False; Visible := False;
Parent := Tree; Parent := Tree;
//todo
{
CalColors.MonthBackColor := clWindow;
CalColors.TextColor := clBlack;
CalColors.TitleBackColor := clBtnShadow;
CalColors.TitleTextColor := clBlack;
CalColors.TrailingTextColor := clBtnFace;
Date := StrToDate(Data.Value); Date := StrToDate(Data.Value);
OnKeyDown := EditKeyDown; OnKeyDown := EditKeyDown;
}
end; end;
end; end;
else else
@ -433,6 +426,8 @@ begin
// Since we don't want to activate grid extensions in the tree (this would influence how the selection is drawn) // Since we don't want to activate grid extensions in the tree (this would influence how the selection is drawn)
// we have to set the edit's width explicitly to the width of the column. // we have to set the edit's width explicitly to the width of the column.
FTree.Header.Columns.GetColumnBounds(FColumn, Dummy, R.Right); FTree.Header.Columns.GetColumnBounds(FColumn, Dummy, R.Right);
if FEdit is TDateEdit then
R.Right := R.Right - TDateEdit(FEdit).ButtonWidth;
FEdit.BoundsRect := R; FEdit.BoundsRect := R;
end; end;
@ -589,21 +584,13 @@ begin
end; end;
vtDate: vtDate:
begin begin
FEdit := TDateTimePicker.Create(nil); FEdit := TDateEdit.Create(nil);
with FEdit as TDateTimePicker do with FEdit as TDateEdit do
begin begin
Visible := False; Visible := False;
Parent := Tree; Parent := Tree;
//todo
{
CalColors.MonthBackColor := clWindow;
CalColors.TextColor := clBlack;
CalColors.TitleBackColor := clBtnShadow;
CalColors.TitleTextColor := clBlack;
CalColors.TrailingTextColor := clBtnFace;
Date := StrToDate(Data.Value[FColumn - 1]); Date := StrToDate(Data.Value[FColumn - 1]);
OnKeyDown := EditKeyDown; OnKeyDown := EditKeyDown;
}
end; end;
end; end;
else else