mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-06 05:37:38 +01:00
LCL, do not immediately start dragging when DragMode=dmAutomatic, added helper to dbgrid to convert and make some sense of mouse coords, fix issue #23558
git-svn-id: trunk@39877 -
This commit is contained in:
parent
2b1a166dd5
commit
ff9e96532a
@ -493,6 +493,7 @@ type
|
||||
function EditorByStyle(Style: TColumnButtonStyle): TWinControl; override;
|
||||
procedure ResetColWidths;
|
||||
destructor Destroy; override;
|
||||
function MouseToRecordOffset(const x,y: Integer; out Column: TColumn; out RecordOffset: Integer): TGridZone;
|
||||
property AllowOutboundEvents;
|
||||
property SelectedField: TField read GetCurrentField write SetCurrentField;
|
||||
property SelectedIndex: Integer read GetSelectedIndex write SetSelectedIndex;
|
||||
@ -3323,6 +3324,31 @@ begin
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
function TCustomDBGrid.MouseToRecordOffset(const x, y: Integer; out
|
||||
Column: TColumn; out RecordOffset: Integer): TGridZone;
|
||||
var
|
||||
aCol,aRow: Integer;
|
||||
begin
|
||||
Result := MouseToGridZone(x, y);
|
||||
|
||||
Column := nil;
|
||||
RecordOffset := 0;
|
||||
|
||||
if (Result=gzInvalid) or (Result=gzFixedCells) then
|
||||
exit;
|
||||
|
||||
MouseToCell(x, y, aCol, aRow);
|
||||
|
||||
if (Result=gzFixedRows) or (Result=gzNormal) then
|
||||
RecordOffset := aRow - Row;
|
||||
|
||||
if (Result=gzFixedCols) or (Result=gzNormal) then begin
|
||||
aRow := ColumnIndexFromGridColumn(aCol);
|
||||
if aRow>=0 then
|
||||
Column := Columns[aRow];
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TComponentDataLink }
|
||||
|
||||
function TComponentDataLink.GetFields(Index: Integer): TField;
|
||||
|
||||
@ -853,6 +853,7 @@ type
|
||||
procedure AssignTo(Dest: TPersistent); override;
|
||||
procedure AutoAdjustColumn(aCol: Integer); virtual;
|
||||
procedure BeforeMoveSelection(const DCol,DRow: Integer); virtual;
|
||||
procedure BeginAutoDrag; override;
|
||||
function BoxRect(ALeft,ATop,ARight,ABottom: Longint): TRect;
|
||||
procedure CacheMouseDown(const X,Y:Integer);
|
||||
procedure CalcAutoSizeColumn(const Index: Integer; var AMin,AMax,APriority: Integer); virtual;
|
||||
@ -7059,6 +7060,17 @@ begin
|
||||
if Assigned(OnBeforeSelection) then OnBeforeSelection(Self, DCol, DRow);
|
||||
end;
|
||||
|
||||
procedure TCustomGrid.BeginAutoDrag;
|
||||
begin
|
||||
if ((goColSizing in Options) and (Cursor=crHSplit)) or
|
||||
((goRowSizing in Options) and (Cursor=crVSplit))
|
||||
then
|
||||
// TODO: Resizing in progress, add an option to forbid resizing
|
||||
// when DragMode=dmAutomatic
|
||||
else
|
||||
BeginDrag(False);
|
||||
end;
|
||||
|
||||
procedure TCustomGrid.CalcAutoSizeColumn(const Index: Integer; var AMin, AMax,
|
||||
APriority: Integer);
|
||||
begin
|
||||
|
||||
Loading…
Reference in New Issue
Block a user