You've already forked lazarus-ccr
fpspreadsheet: Fix TsCellIndicator to display only the base of a merged block
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6284 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -282,6 +282,7 @@ type
|
|||||||
procedure SetWorkbookSource(AValue: TsWorkbookSource);
|
procedure SetWorkbookSource(AValue: TsWorkbookSource);
|
||||||
protected
|
protected
|
||||||
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
||||||
|
procedure UpdateDisplay;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -2184,26 +2185,10 @@ end;
|
|||||||
-------------------------------------------------------------------------------}
|
-------------------------------------------------------------------------------}
|
||||||
procedure TsCellIndicator.ListenerNotification(AChangedItems: TsNotificationItems;
|
procedure TsCellIndicator.ListenerNotification(AChangedItems: TsNotificationItems;
|
||||||
AData: Pointer = nil);
|
AData: Pointer = nil);
|
||||||
var
|
|
||||||
sel: TsCellRangeArray;
|
|
||||||
s: String;
|
|
||||||
rng: TsCellRange;
|
|
||||||
numrows, numcols: Integer;
|
|
||||||
begin
|
begin
|
||||||
Unused(AData);
|
Unused(AData);
|
||||||
if (lniSelection in AChangedItems) and (Worksheet <> nil) then
|
if (lniSelection in AChangedItems) and (Worksheet <> nil) then
|
||||||
begin
|
UpdateDisplay;
|
||||||
s := GetCellString(Worksheet.ActiveCellRow, Worksheet.ActiveCellCol);
|
|
||||||
sel := Worksheet.GetSelection;
|
|
||||||
if Length(sel) > 0 then begin
|
|
||||||
rng := sel[High(sel)];
|
|
||||||
numrows := rng.Row2 - rng.Row1 + 1;
|
|
||||||
numcols := rng.Col2 - rng.Col1 + 1;
|
|
||||||
if (numrows <> 1) or (numcols <> 1) then
|
|
||||||
s := Format('%s (%d R x %d C)', [s, rng.Row2-rng.Row1+1, rng.Col2-rng.Col1+1]);
|
|
||||||
end;
|
|
||||||
Text := s;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{@@ ----------------------------------------------------------------------------
|
{@@ ----------------------------------------------------------------------------
|
||||||
@ -2242,6 +2227,37 @@ begin
|
|||||||
ListenerNotification([lniSelection]);
|
ListenerNotification([lniSelection]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TsCellIndicator.UpdateDisplay;
|
||||||
|
var
|
||||||
|
sel: TsCellRangeArray;
|
||||||
|
s: String;
|
||||||
|
rng: TsCellRange;
|
||||||
|
numrows, numcols: Integer;
|
||||||
|
r, c: Cardinal;
|
||||||
|
cell: PCell;
|
||||||
|
begin
|
||||||
|
r := Worksheet.ActiveCellRow;
|
||||||
|
c := Worksheet.ActiveCellCol;
|
||||||
|
cell := Worksheet.FindCell(r, c);
|
||||||
|
if cell <> nil then begin
|
||||||
|
cell := Worksheet.FindMergeBase(cell);
|
||||||
|
if cell <> nil then begin
|
||||||
|
r := cell^.Row;
|
||||||
|
c := cell^.Col;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
s := GetCellString(r, c);
|
||||||
|
sel := Worksheet.GetSelection;
|
||||||
|
if Length(sel) > 0 then begin
|
||||||
|
rng := sel[High(sel)];
|
||||||
|
numrows := rng.Row2 - rng.Row1 + 1;
|
||||||
|
numcols := rng.Col2 - rng.Col1 + 1;
|
||||||
|
if (numrows <> 1) or (numcols <> 1) then
|
||||||
|
s := Format('%s (%d R x %d C)', [s, rng.Row2-rng.Row1+1, rng.Col2-rng.Col1+1]);
|
||||||
|
end;
|
||||||
|
Text := s;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
{ TsCellCombobox }
|
{ TsCellCombobox }
|
||||||
|
Reference in New Issue
Block a user