LCL, grids, fixed auto editing and added AutoEdit property

git-svn-id: trunk@11752 -
This commit is contained in:
jesus 2007-08-07 00:05:10 +00:00
parent a799777f36
commit 7ecce099a2
2 changed files with 31 additions and 12 deletions

View File

@ -484,6 +484,7 @@ type
property AlternateColor; property AlternateColor;
property Anchors; property Anchors;
property AutoAdvance default aaRightDown; property AutoAdvance default aaRightDown;
property AutoEdit;
property AutoFillColumns; property AutoFillColumns;
//property BiDiMode; //property BiDiMode;
property BorderSpacing; property BorderSpacing;

View File

@ -522,6 +522,7 @@ type
private private
FAlternateColor: TColor; FAlternateColor: TColor;
FAutoAdvance: TAutoAdvance; FAutoAdvance: TAutoAdvance;
FAutoEdit: boolean;
FAutoFillColumns: boolean; FAutoFillColumns: boolean;
FBorderColor: TColor; FBorderColor: TColor;
FDefaultDrawing: Boolean; FDefaultDrawing: Boolean;
@ -847,6 +848,7 @@ type
property AllowOutboundEvents: boolean read FAllowOutboundEvents write FAllowOutboundEvents default true; property AllowOutboundEvents: boolean read FAllowOutboundEvents write FAllowOutboundEvents default true;
property AlternateColor: TColor read FAlternateColor write SetAlternateColor stored IsAltColorStored; property AlternateColor: TColor read FAlternateColor write SetAlternateColor stored IsAltColorStored;
property AutoAdvance: TAutoAdvance read FAutoAdvance write FAutoAdvance default aaRight; property AutoAdvance: TAutoAdvance read FAutoAdvance write FAutoAdvance default aaRight;
property AutoEdit: boolean read FAutoEdit write FAutoEdit default true;
property AutoFillColumns: boolean read FAutoFillColumns write SetAutoFillColumns; property AutoFillColumns: boolean read FAutoFillColumns write SetAutoFillColumns;
property BorderStyle default bsSingle; property BorderStyle default bsSingle;
property BorderColor: TColor read FBorderColor write SetBorderColor default cl3DDKShadow; property BorderColor: TColor read FBorderColor write SetBorderColor default cl3DDKShadow;
@ -1130,6 +1132,7 @@ type
property AlternateColor; property AlternateColor;
property Anchors; property Anchors;
property AutoAdvance; property AutoAdvance;
property AutoEdit;
property AutoFillColumns; property AutoFillColumns;
//property BiDiMode; //property BiDiMode;
property BorderSpacing; property BorderSpacing;
@ -1282,6 +1285,7 @@ type
property AlternateColor; property AlternateColor;
property Anchors; property Anchors;
property AutoAdvance; property AutoAdvance;
property AutoEdit;
property AutoFillColumns; property AutoFillColumns;
//property BiDiMode; //property BiDiMode;
property BorderSpacing; property BorderSpacing;
@ -4425,6 +4429,16 @@ var
InvalidateCell(PushedCell.x, PushedCell.y); InvalidateCell(PushedCell.x, PushedCell.y);
end; end;
end; end;
function DoAutoEdit: boolean;
begin
result := FAutoEdit and (goEditing in Options) and
(FSplitter.X=Col) and (FSplitter.Y=Row);
if result then begin
SelectEditor;
EditorShow(True);
end;
end;
begin begin
inherited MouseDown(Button, Shift, X, Y); inherited MouseDown(Button, Shift, X, Y);
@ -4499,26 +4513,29 @@ begin
if not (goEditing in Options) or if not (goEditing in Options) or
(ExtendedSelect and not EditorAlwaysShown) then begin (ExtendedSelect and not EditorAlwaysShown) then begin
if ssShift in Shift then begin
SelectActive:=(goRangeSelect in Options); if ssShift in Shift then
end else begin SelectActive:=(goRangeSelect in Options)
else begin
// shift is not pressed any more cancel SelectActive if necessary // shift is not pressed any more cancel SelectActive if necessary
if SelectActive then if SelectActive then
CancelSelection; CancelSelection;
if not SelectActive then begin if not SelectActive then begin
if not DoAutoEdit then
// delay select active until mouse reachs another cell
// do that only if editor is not shown
GridFlags := GridFlags + [gfNeedsSelectActive];
FPivot:=FSplitter; FPivot:=FSplitter;
GridFlags := GridFlags + [gfNeedsSelectActive];
// delay select active until mouse reachs another cell
end; end;
end; end;
end else if (FSplitter.X=Col) and (FSplitter.Y=Row) then begin
//if WasFocused then begin end else if DoAutoEdit then begin
SelectEditor; {$ifDef dbgGrid} DebugLn('MouseDown (autoedit) END'); {$Endif}
EditorShow(True); Exit;
{$ifDef dbgGrid} DebugLn('MouseDown (autoedit) END'); {$Endif}
exit;
//end;
end; end;
if not MoveExtend(False, FSplitter.X, FSplitter.Y) then begin if not MoveExtend(False, FSplitter.X, FSplitter.Y) then begin
@ -6472,6 +6489,7 @@ begin
FTitleFontIsDefault := True; FTitleFontIsDefault := True;
FAutoAdvance := aaRight; FAutoAdvance := aaRight;
FAutoEdit := True;
FFocusRectVisible := True; FFocusRectVisible := True;
FDefaultDrawing := True; FDefaultDrawing := True;
FOptions:= FOptions:=