You've already forked lazarus-ccr
fpspreadsheet: Refactor WorksheetGrid behavior on ESC key
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5211 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -62,7 +62,6 @@ type
|
|||||||
FFrozenCols: Integer;
|
FFrozenCols: Integer;
|
||||||
FFrozenRows: Integer;
|
FFrozenRows: Integer;
|
||||||
FEditText: String;
|
FEditText: String;
|
||||||
FOldEditText: String;
|
|
||||||
FLockCount: Integer;
|
FLockCount: Integer;
|
||||||
FLockSetup: Integer;
|
FLockSetup: Integer;
|
||||||
FEditing: Boolean;
|
FEditing: Boolean;
|
||||||
@ -108,7 +107,7 @@ type
|
|||||||
function GetCellFontSizes(ALeft, ATop, ARight, ABottom: Integer): Single;
|
function GetCellFontSizes(ALeft, ATop, ARight, ABottom: Integer): Single;
|
||||||
function GetCellFontStyle(ACol, ARow: Integer): TsFontStyles;
|
function GetCellFontStyle(ACol, ARow: Integer): TsFontStyles;
|
||||||
function GetCellFontStyles(ALeft, ATop, ARight, ABottom: Integer): TsFontStyles;
|
function GetCellFontStyles(ALeft, ATop, ARight, ABottom: Integer): TsFontStyles;
|
||||||
function GetCells(ACol, ARow: Integer): variant; reintroduce;
|
function GetCellValue(ACol, ARow: Integer): variant;
|
||||||
function GetColWidths(ACol: Integer): Integer;
|
function GetColWidths(ACol: Integer): Integer;
|
||||||
function GetDefColWidth: Integer;
|
function GetDefColWidth: Integer;
|
||||||
function GetDefRowHeight: Integer;
|
function GetDefRowHeight: Integer;
|
||||||
@ -151,7 +150,7 @@ type
|
|||||||
procedure SetCellFontStyle(ACol, ARow: Integer; AValue: TsFontStyles);
|
procedure SetCellFontStyle(ACol, ARow: Integer; AValue: TsFontStyles);
|
||||||
procedure SetCellFontStyles(ALeft, ATop, ARight, ABottom: Integer;
|
procedure SetCellFontStyles(ALeft, ATop, ARight, ABottom: Integer;
|
||||||
AValue: TsFontStyles);
|
AValue: TsFontStyles);
|
||||||
procedure SetCells(ACol, ARow: Integer; AValue: variant);
|
procedure SetCellValue(ACol, ARow: Integer; AValue: variant);
|
||||||
procedure SetColWidths(ACol: Integer; AValue: Integer);
|
procedure SetColWidths(ACol: Integer; AValue: Integer);
|
||||||
procedure SetDefColWidth(AValue: Integer);
|
procedure SetDefColWidth(AValue: Integer);
|
||||||
procedure SetDefRowHeight(AValue: Integer);
|
procedure SetDefRowHeight(AValue: Integer);
|
||||||
@ -213,6 +212,7 @@ type
|
|||||||
procedure ExecuteHyperlink;
|
procedure ExecuteHyperlink;
|
||||||
function GetCellHeight(ACol, ARow: Integer): Integer;
|
function GetCellHeight(ACol, ARow: Integer): Integer;
|
||||||
function GetCellHintText(ACol, ARow: Integer): String; override;
|
function GetCellHintText(ACol, ARow: Integer): String; override;
|
||||||
|
function GetCells(ACol, ARow: Integer): String; override;
|
||||||
function GetCellText(ACol, ARow: Integer): String;
|
function GetCellText(ACol, ARow: Integer): String;
|
||||||
function GetEditText(ACol, ARow: Integer): String; override;
|
function GetEditText(ACol, ARow: Integer): String; override;
|
||||||
function GetDefaultHeaderColWidth: Integer;
|
function GetDefaultHeaderColWidth: Integer;
|
||||||
@ -230,7 +230,7 @@ type
|
|||||||
procedure MouseUp(Button: TMouseButton; Shift:TShiftState; X,Y:Integer); override;
|
procedure MouseUp(Button: TMouseButton; Shift:TShiftState; X,Y:Integer); override;
|
||||||
procedure MoveSelection; override;
|
procedure MoveSelection; override;
|
||||||
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
||||||
procedure SelectEditor; override;
|
// procedure SelectEditor; override;
|
||||||
procedure SelPenChangeHandler(Sender: TObject);
|
procedure SelPenChangeHandler(Sender: TObject);
|
||||||
procedure SetEditText(ACol, ARow: Longint; const AValue: string); override;
|
procedure SetEditText(ACol, ARow: Longint; const AValue: string); override;
|
||||||
procedure Setup;
|
procedure Setup;
|
||||||
@ -409,7 +409,7 @@ type
|
|||||||
read GetCellFontSizes write SetCellFontSizes;
|
read GetCellFontSizes write SetCellFontSizes;
|
||||||
{@@ Cell values }
|
{@@ Cell values }
|
||||||
property Cells[ACol, ARow: Integer]: Variant
|
property Cells[ACol, ARow: Integer]: Variant
|
||||||
read GetCells write SetCells;
|
read GetCellValue write SetCellValue;
|
||||||
{@@ Parameter for horizontal text alignment within the cell at column ACol
|
{@@ Parameter for horizontal text alignment within the cell at column ACol
|
||||||
and row ARow }
|
and row ARow }
|
||||||
property HorAlignment[ACol, ARow: Integer]: TsHorAlignment
|
property HorAlignment[ACol, ARow: Integer]: TsHorAlignment
|
||||||
@ -3153,6 +3153,11 @@ begin
|
|||||||
OnGetCellHint(self, ACol, ARow, Result);
|
OnGetCellHint(self, ACol, ARow, Result);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TsCustomWorksheetGrid.GetCells(ACol, ARow: Integer): String;
|
||||||
|
begin
|
||||||
|
Result := GetCellText(ACol, ARow);
|
||||||
|
end;
|
||||||
|
|
||||||
{@@ ----------------------------------------------------------------------------
|
{@@ ----------------------------------------------------------------------------
|
||||||
This function returns the text to be shown in a grid cell. The text is looked
|
This function returns the text to be shown in a grid cell. The text is looked
|
||||||
up in the corresponding cell of the worksheet by calling its ReadAsUTF8Text
|
up in the corresponding cell of the worksheet by calling its ReadAsUTF8Text
|
||||||
@ -3840,13 +3845,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
VK_F2:
|
VK_F2:
|
||||||
FEnhEditMode := true;
|
FEnhEditMode := true;
|
||||||
VK_ESCAPE:
|
|
||||||
if FEditing then
|
|
||||||
begin
|
|
||||||
SetEditText(Col, Row, FOldEditText);
|
|
||||||
EditorHide;
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
inherited;
|
inherited;
|
||||||
@ -4295,17 +4293,6 @@ begin
|
|||||||
Workbook.WriteToFile(AFileName, AOverwriteExisting);
|
Workbook.WriteToFile(AFileName, AOverwriteExisting);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{@@ ----------------------------------------------------------------------------
|
|
||||||
Standard method inherited from TCustomGrid: Is called when editing starts.
|
|
||||||
Is overridden here to store the old text just in case that the user presses
|
|
||||||
ESC to cancel editing.
|
|
||||||
-------------------------------------------------------------------------------}
|
|
||||||
procedure TsCustomWorksheetGrid.SelectEditor;
|
|
||||||
begin
|
|
||||||
FOldEditText := GetCellText(Col, Row);
|
|
||||||
inherited;
|
|
||||||
end;
|
|
||||||
|
|
||||||
{@@ ----------------------------------------------------------------------------
|
{@@ ----------------------------------------------------------------------------
|
||||||
Loads the workbook into the grid and selects the sheet with the given index.
|
Loads the workbook into the grid and selects the sheet with the given index.
|
||||||
"Selected" means here that the sheet is loaded into the grid.
|
"Selected" means here that the sheet is loaded into the grid.
|
||||||
@ -4881,7 +4868,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TsCustomWorksheetGrid.GetCells(ACol, ARow: Integer): variant;
|
function TsCustomWorksheetGrid.GetCellValue(ACol, ARow: Integer): variant;
|
||||||
var
|
var
|
||||||
cell: PCell;
|
cell: PCell;
|
||||||
begin
|
begin
|
||||||
@ -5440,7 +5427,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TsCustomWorksheetGrid.SetCells(ACol, ARow: Integer; AValue: Variant);
|
procedure TsCustomWorksheetGrid.SetCellValue(ACol, ARow: Integer; AValue: Variant);
|
||||||
var
|
var
|
||||||
cell: PCell = nil;
|
cell: PCell = nil;
|
||||||
fmt: PsCellFormat = nil;
|
fmt: PsCellFormat = nil;
|
||||||
|
Reference in New Issue
Block a user