You've already forked lazarus-ccr
fpspreadsheet: Restore old cell content if ESC is pressed in the TsCellEdit.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5213 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -233,11 +233,13 @@ type
|
||||
private
|
||||
FWorkbookSource: TsWorkbookSource;
|
||||
FShowHTMLText: Boolean;
|
||||
FOldText: String;
|
||||
function GetSelectedCell: PCell;
|
||||
function GetWorkbook: TsWorkbook;
|
||||
function GetWorksheet: TsWorksheet;
|
||||
procedure SetWorkbookSource(AValue: TsWorkbookSource);
|
||||
protected
|
||||
procedure KeyDown(var Key : Word; Shift : TShiftState); override;
|
||||
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
||||
procedure ShowCell(ACell: PCell); virtual;
|
||||
public
|
||||
@ -1854,6 +1856,23 @@ begin
|
||||
Result := nil;
|
||||
end;
|
||||
|
||||
{@@ ----------------------------------------------------------------------------
|
||||
Inherited KeyDown method. Overridden here in order to be able to restore the
|
||||
old cell content if ESC is pressed.
|
||||
-------------------------------------------------------------------------------}
|
||||
procedure TsCellEdit.KeyDown(var Key: Word; Shift : TShiftState);
|
||||
var
|
||||
selpos: Integer;
|
||||
begin
|
||||
if Key = VK_ESCAPE then begin
|
||||
selpos := SelStart;
|
||||
Lines.Text := FOldText;
|
||||
SelStart := selpos;
|
||||
exit;
|
||||
end;
|
||||
inherited;
|
||||
end;
|
||||
|
||||
{@@ ----------------------------------------------------------------------------
|
||||
Notification message received from the WorkbookSource telling which item
|
||||
of the spreadsheet has changed.
|
||||
@ -1962,6 +1981,7 @@ begin
|
||||
end;
|
||||
end else
|
||||
Clear;
|
||||
FOldText := Lines.Text;
|
||||
end;
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user