mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-27 14:20:38 +02:00
TAChart: Workaround for TChartListbox not detecting clicks on checkbox and series icon correctly on macOS Monterey. See https://forum.lazarus.freepascal.org/index.php/topic,61074.msg458489.html.
This commit is contained in:
parent
f45f3610f4
commit
e171cf6f33
@ -549,7 +549,7 @@ end;
|
|||||||
procedure TChartListbox.MouseDown(
|
procedure TChartListbox.MouseDown(
|
||||||
AButton: TMouseButton; AShift: TShiftState; AX, AY: Integer);
|
AButton: TMouseButton; AShift: TShiftState; AX, AY: Integer);
|
||||||
var
|
var
|
||||||
rcb, ricon: TRect;
|
R, rcb, ricon: TRect;
|
||||||
index: Integer;
|
index: Integer;
|
||||||
p: TPoint;
|
p: TPoint;
|
||||||
begin
|
begin
|
||||||
@ -560,7 +560,17 @@ begin
|
|||||||
p := Point(AX, AY);
|
p := Point(AX, AY);
|
||||||
index := GetIndexAtXY(AX, AY);
|
index := GetIndexAtXY(AX, AY);
|
||||||
if index < 0 then exit;
|
if index < 0 then exit;
|
||||||
CalcRects(ItemRect(index), rcb, ricon);
|
R := ItemRect(index);
|
||||||
|
{$IFDEF DARWIN}
|
||||||
|
{ Workaround for ItemRect returning something different than what is
|
||||||
|
passed to DrawItem in macOS Monterey.
|
||||||
|
See discussion in https://forum.lazarus.freepascal.org/index.php/topic,61074.0.html
|
||||||
|
The consequence of this workaround is that there can only be a single
|
||||||
|
column, but Columns > 1 does not work on cocoa anyway. }
|
||||||
|
R.Left := 0;
|
||||||
|
R.Right := ClientWidth;
|
||||||
|
{$ENDIF}
|
||||||
|
CalcRects(R, rcb, ricon);
|
||||||
if (cloShowCheckboxes in Options) and IsPointInRect(p, rcb) then
|
if (cloShowCheckboxes in Options) and IsPointInRect(p, rcb) then
|
||||||
ClickedCheckbox(index)
|
ClickedCheckbox(index)
|
||||||
else if (cloShowIcons in Options) and IsPointInRect(p, ricon) then
|
else if (cloShowIcons in Options) and IsPointInRect(p, ricon) then
|
||||||
|
Loading…
Reference in New Issue
Block a user