You've already forked lazarus-ccr
fpspreadsheet: FPSpreadsheetGrid enters "enhanced edit mode" (remove formatting, show formulas) also by mouse click into cell (in addition to F2). Editing of cell content now seems to be consistent with Excel.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3750 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -4,15 +4,15 @@ object Form1: TForm1
|
|||||||
Top = 214
|
Top = 214
|
||||||
Width = 922
|
Width = 922
|
||||||
Caption = 'Form1'
|
Caption = 'Form1'
|
||||||
ClientHeight = 580
|
ClientHeight = 575
|
||||||
ClientWidth = 922
|
ClientWidth = 922
|
||||||
Menu = MainMenu
|
Menu = MainMenu
|
||||||
ShowHint = True
|
ShowHint = True
|
||||||
LCLVersion = '1.3'
|
LCLVersion = '1.3'
|
||||||
object WorkbookTabControl: TsWorkbookTabControl
|
object WorkbookTabControl: TsWorkbookTabControl
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 497
|
Height = 490
|
||||||
Top = 83
|
Top = 85
|
||||||
Width = 669
|
Width = 669
|
||||||
TabIndex = 0
|
TabIndex = 0
|
||||||
Tabs.Strings = (
|
Tabs.Strings = (
|
||||||
@@ -23,8 +23,8 @@ object Form1: TForm1
|
|||||||
WorkbookSource = WorkbookSource
|
WorkbookSource = WorkbookSource
|
||||||
object WorksheetGrid: TsWorksheetGrid
|
object WorksheetGrid: TsWorksheetGrid
|
||||||
Left = 2
|
Left = 2
|
||||||
Height = 472
|
Height = 460
|
||||||
Top = 23
|
Top = 28
|
||||||
Width = 665
|
Width = 665
|
||||||
FrozenCols = 0
|
FrozenCols = 0
|
||||||
FrozenRows = 0
|
FrozenRows = 0
|
||||||
@@ -78,8 +78,8 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object InspectorTabControl: TTabControl
|
object InspectorTabControl: TTabControl
|
||||||
Left = 674
|
Left = 674
|
||||||
Height = 497
|
Height = 490
|
||||||
Top = 83
|
Top = 85
|
||||||
Width = 248
|
Width = 248
|
||||||
OnChange = InspectorTabControlChange
|
OnChange = InspectorTabControlChange
|
||||||
TabIndex = 0
|
TabIndex = 0
|
||||||
@@ -94,8 +94,8 @@ object Form1: TForm1
|
|||||||
Visible = False
|
Visible = False
|
||||||
object Inspector: TsSpreadsheetInspector
|
object Inspector: TsSpreadsheetInspector
|
||||||
Left = 2
|
Left = 2
|
||||||
Height = 472
|
Height = 460
|
||||||
Top = 23
|
Top = 28
|
||||||
Width = 244
|
Width = 244
|
||||||
Align = alClient
|
Align = alClient
|
||||||
RowCount = 25
|
RowCount = 25
|
||||||
@@ -108,7 +108,7 @@ object Form1: TForm1
|
|||||||
'Options=boAutoCalc, boCalcBeforeSaving, boReadFormulas'
|
'Options=boAutoCalc, boCalcBeforeSaving, boReadFormulas'
|
||||||
'FormatSettings='
|
'FormatSettings='
|
||||||
' ThousandSeparator=.'
|
' ThousandSeparator=.'
|
||||||
' DecimalSeparator=.'
|
' DecimalSeparator=,'
|
||||||
' ListSeparator=;'
|
' ListSeparator=;'
|
||||||
' DateSeparator=.'
|
' DateSeparator=.'
|
||||||
' TimeSeparator=:'
|
' TimeSeparator=:'
|
||||||
@@ -134,22 +134,22 @@ object Form1: TForm1
|
|||||||
WorkbookSource = WorkbookSource
|
WorkbookSource = WorkbookSource
|
||||||
Mode = imWorkbook
|
Mode = imWorkbook
|
||||||
ColWidths = (
|
ColWidths = (
|
||||||
111
|
109
|
||||||
112
|
110
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object Splitter1: TSplitter
|
object Splitter1: TSplitter
|
||||||
Left = 669
|
Left = 669
|
||||||
Height = 497
|
Height = 490
|
||||||
Top = 83
|
Top = 85
|
||||||
Width = 5
|
Width = 5
|
||||||
Align = alRight
|
Align = alRight
|
||||||
ResizeAnchor = akRight
|
ResizeAnchor = akRight
|
||||||
end
|
end
|
||||||
object ToolBar1: TToolBar
|
object ToolBar1: TToolBar
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 26
|
Height = 28
|
||||||
Top = 24
|
Top = 24
|
||||||
Width = 922
|
Width = 922
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
@@ -329,10 +329,10 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object FontnameCombo: TsFontNameCombobox
|
object FontnameCombo: TsFontNameCombobox
|
||||||
Left = 54
|
Left = 54
|
||||||
Height = 23
|
Height = 28
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 151
|
Width = 151
|
||||||
ItemHeight = 15
|
ItemHeight = 20
|
||||||
ItemIndex = 62
|
ItemIndex = 62
|
||||||
Items.Strings = (
|
Items.Strings = (
|
||||||
'@Arial Unicode MS'
|
'@Arial Unicode MS'
|
||||||
@@ -1129,10 +1129,10 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object sFontSizeCombobox1: TsFontSizeCombobox
|
object sFontSizeCombobox1: TsFontSizeCombobox
|
||||||
Left = 205
|
Left = 205
|
||||||
Height = 23
|
Height = 28
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 60
|
Width = 60
|
||||||
ItemHeight = 15
|
ItemHeight = 20
|
||||||
ItemIndex = 2
|
ItemIndex = 2
|
||||||
Items.Strings = (
|
Items.Strings = (
|
||||||
'8'
|
'8'
|
||||||
@@ -1287,7 +1287,7 @@ object Form1: TForm1
|
|||||||
object ToolBar3: TToolBar
|
object ToolBar3: TToolBar
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 28
|
Height = 28
|
||||||
Top = 50
|
Top = 52
|
||||||
Width = 922
|
Width = 922
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
Caption = 'ToolBar3'
|
Caption = 'ToolBar3'
|
||||||
@@ -1306,7 +1306,7 @@ object Form1: TForm1
|
|||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
object CellIndicator: TsCellIndicator
|
object CellIndicator: TsCellIndicator
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 23
|
Height = 28
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 138
|
Width = 138
|
||||||
Align = alTop
|
Align = alTop
|
||||||
@@ -1337,7 +1337,7 @@ object Form1: TForm1
|
|||||||
Cursor = crVSplit
|
Cursor = crVSplit
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 5
|
Height = 5
|
||||||
Top = 78
|
Top = 80
|
||||||
Width = 922
|
Width = 922
|
||||||
Align = alTop
|
Align = alTop
|
||||||
ResizeAnchor = akTop
|
ResizeAnchor = akTop
|
||||||
@@ -4066,6 +4066,7 @@ object Form1: TForm1
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
object MainMenu: TMainMenu
|
object MainMenu: TMainMenu
|
||||||
|
Images = ImageList
|
||||||
left = 176
|
left = 176
|
||||||
top = 376
|
top = 376
|
||||||
object MnuFile: TMenuItem
|
object MnuFile: TMenuItem
|
||||||
|
@@ -155,6 +155,7 @@ type
|
|||||||
procedure KeyDown(var Key : Word; Shift : TShiftState); override;
|
procedure KeyDown(var Key : Word; Shift : TShiftState); override;
|
||||||
procedure Loaded; override;
|
procedure Loaded; override;
|
||||||
procedure LoadFromWorksheet(AWorksheet: TsWorksheet);
|
procedure LoadFromWorksheet(AWorksheet: TsWorksheet);
|
||||||
|
procedure MouseDown(Button: TMouseButton; Shift:TShiftState; X,Y:Integer); override;
|
||||||
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
|
procedure MouseMove(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;
|
||||||
@@ -2416,6 +2417,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
if Result[1] <> '=' then Result := '=' + Result;
|
if Result[1] <> '=' then Result := '=' + Result;
|
||||||
end else
|
end else
|
||||||
|
if cell <> nil then
|
||||||
case cell^.ContentType of
|
case cell^.ContentType of
|
||||||
cctNumber:
|
cctNumber:
|
||||||
Result := FloatToStr(cell^.NumberValue);
|
Result := FloatToStr(cell^.NumberValue);
|
||||||
@@ -2426,10 +2428,12 @@ begin
|
|||||||
Result := FormatDateTime('c', cell^.DateTimeValue);
|
Result := FormatDateTime('c', cell^.DateTimeValue);
|
||||||
else
|
else
|
||||||
Result := Worksheet.ReadAsUTF8Text(cell);
|
Result := Worksheet.ReadAsUTF8Text(cell);
|
||||||
end;
|
end
|
||||||
|
else
|
||||||
|
Result := '';
|
||||||
end else
|
end else
|
||||||
Result := GetCellText(aCol, aRow);
|
Result := GetCellText(aCol, aRow);
|
||||||
if Assigned(OnGetEditText) then OnGetEditText(Self, aCol, aRow, result);
|
if Assigned(OnGetEditText) then OnGetEditText(Self, aCol, aRow, Result);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{@@ ----------------------------------------------------------------------------
|
{@@ ----------------------------------------------------------------------------
|
||||||
@@ -3066,6 +3070,17 @@ begin
|
|||||||
);
|
);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{@@ ----------------------------------------------------------------------------
|
||||||
|
Standard mouse down handler. Is overridden here to enter "enhanced edit mode"
|
||||||
|
which removes formatting from the values and presents formulas for editing.
|
||||||
|
-------------------------------------------------------------------------------}
|
||||||
|
procedure TsCustomWorksheetGrid.MouseDown(Button: TMouseButton;
|
||||||
|
Shift: TShiftState; X, Y: Integer);
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
FEnhEditMode := true;
|
||||||
|
end;
|
||||||
|
|
||||||
{@@ ----------------------------------------------------------------------------
|
{@@ ----------------------------------------------------------------------------
|
||||||
Standard mouse move handler. Is overridden because, if TextOverflow is active,
|
Standard mouse move handler. Is overridden because, if TextOverflow is active,
|
||||||
overflown cell may be erased when the mouse leaves them; repaints entire
|
overflown cell may be erased when the mouse leaves them; repaints entire
|
||||||
|
Reference in New Issue
Block a user