mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-07 10:01:12 +02:00
LCL, grids's MouseToCell methods returns coords -1 if point is out of bounds, patch from Tomasz Wieckowski with changes, issue #14619
git-svn-id: trunk@21870 -
This commit is contained in:
parent
6abd81a239
commit
bdc10fa6ce
@ -4633,7 +4633,10 @@ begin
|
||||
if (Index>=0) and (Index<ColCount) then
|
||||
Offset:=Offset-FixedWidth+integer(PtrUInt(AccumWidth[Index]))+TLColOff;
|
||||
if (Index<0) or (Index>=ColCount) or (Offset>GridWidth-1) then begin
|
||||
Index := ColCount-1;
|
||||
if AllowOutboundEvents then
|
||||
Index := ColCount-1
|
||||
else
|
||||
Index := -1;
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
@ -4652,7 +4655,10 @@ begin
|
||||
if (Index>=0) and (Index<RowCount) then
|
||||
Offset:=Offset-FixedHeight+integer(PtrUInt(AccumHeight[Index]))+TLRowOff;
|
||||
if (Index<0) or (Index>=RowCount) or (Offset>GridHeight-1) then begin
|
||||
Index:=RowCount-1;
|
||||
if AllowOutboundEvents then
|
||||
Index := RowCount-1
|
||||
else
|
||||
Index := -1;
|
||||
Exit; // Out of Range
|
||||
end;
|
||||
end;
|
||||
@ -5705,7 +5711,13 @@ var
|
||||
begin
|
||||
// Do not raise Exception if out of range
|
||||
OffsetToColRow(True, True, X, ACol, dummy);
|
||||
OffsetToColRow(False,True, Y, ARow, dummy);
|
||||
if ACol<0 then
|
||||
ARow := -1
|
||||
else begin
|
||||
OffsetToColRow(False,True, Y, ARow, dummy);
|
||||
if ARow<0 then
|
||||
ACol := -1;
|
||||
end;
|
||||
end;
|
||||
|
||||
{ Convert a fisical Mouse coordinate into a logical cell coordinate }
|
||||
|
Loading…
Reference in New Issue
Block a user