fpspreadsheet: Show arrow cursor for dragging current cell in WorksheetGrid only after short delay.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6529 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2018-06-25 07:19:34 +00:00
parent a261368a22
commit f8229f7caa

View File

@ -148,6 +148,7 @@ type
FDragStartCol, FDragStartRow: Integer;
FOldDragStartCol, FOldDragStartRow: Integer;
FDragSelection: TGridRect;
FDragTimer: TTimer;
FGetRowHeaderText: TsGetCellTextEvent;
FGetColHeaderText: TsGetCellTextEvent;
FRefocusing: TObject;
@ -255,6 +256,7 @@ type
procedure SetWordwraps(ALeft, ATop, ARight, ABottom: Integer; AValue: boolean);
procedure SetZoomFactor(AValue: Double);
procedure DragTimerElapsed(Sender: TObject);
procedure HyperlinkTimerElapsed(Sender: TObject);
protected
@ -874,6 +876,10 @@ const
hyperlink cell until the associated hyperlink is executed. }
HYPERLINK_TIMER_INTERVAL = 500;
{@@ Interval how long the mouse must stay on the border of the selected
cell for the drag-cursor to appear. }
DRAG_TIMER_INTERVAL = 200;
const
// Constants for AGridPart parameter
DRAW_NON_FROZEN = 0;
@ -1525,12 +1531,17 @@ begin
FHyperlinkTimer := TTimer.Create(self);
FHyperlinkTimer.Interval := HYPERLINK_TIMER_INTERVAL;
FHyperlinkTimer.OnTimer := @HyperlinkTimerElapsed;
FDragTimer := TTimer.Create(self);
FDragTimer.Interval := DRAG_TIMER_INTERVAL;
FDragTimer.OnTimer := @DragTimerElapsed;
FAllowDragAndDrop := true;
SetWorkbookSource(FInternalWorkbookSource);
{$IFNDEF FPS_NO_GRID_MULTISELECT}
RangeSelectMode := rsmMulti;
{$ENDIF}
FAllowDragAndDrop := true;
(*
FSingleLineStringEditor := TsSingleLineStringCellEditor.Create(self);
FSingleLineStringEditor.name :='SingleLineStringEditor';
@ -2505,6 +2516,18 @@ begin
end;
end;
procedure TsCustomWorksheetGrid.DragTimerElapsed(Sender: TObject);
var
P: TPoint;
begin
FDragTimer.Enabled := false;
P := ScreenToClient(Mouse.CursorPos);
if MouseOnCellBorder(P, Selection) then
Cursor := crSize
else
Cursor := crDefault;
end;
{@@ ----------------------------------------------------------------------------
This method is inherited from TsCustomGrid, but is overridden here in order
to paint the cell borders and the selection rectangle.
@ -5385,7 +5408,7 @@ begin
}
if Assigned(Dragmanager) and DragManager.IsDragging then
begin;
begin
Cursor := crDefault;
end else
begin
@ -5393,7 +5416,7 @@ begin
FHyperlinkTimer.Enabled := false;
if MouseOnCellBorder(Point(X, Y), Selection) then
Cursor := crSize
FDragTimer.Enabled := true
else
Cursor := crDefault;
end;