Thank you. The problem seems to be that MouseDown and DrawItem get different information on the location of the item to be handled. MouseDown queries the method ItemRect(index), and this gets the data from calling the corresponding cocoa widgetset function. DrawItem, on the other hand, gets the rectangle for painting as a parameter -- some other function must have determined it. I don't have enough knowledge of cocoa to be able to say which one it is, and I don't see anything obvious in the cocoa widgetset units (which are in folder lcl/interfaces/cocoa, by the way). But fact is that both procedures pass a different rectangle information to CalcRect, and so DrawItem paints the checkbox at a location different from what Mousedown assumes (shifted by 16 pixels).
Anyway, I think I can show you a workaround: Let's ignore the left and right borders of the rectangle returned by the ItemRect function and replace them by 0 and ClientWidth respectively (the vertical coordinates do not seem to be a problem). And if we put this into an IFDEF directive even the other widgetsets can live with it.
So, please replace your MouseDown procedure (the one from the Laz-main version in my previous zip, not the original one of Laz 2.2.5) by the following code and test again:
procedure TChartListbox.MouseDown(
AButton: TMouseButton; AShift: TShiftState; AX, AY: Integer);
var
R, rcb, ricon: TRect;
index: Integer;
p: TPoint;
begin
FDown := true;
FSeriesIconClicked := -1;
try
if AButton <> mbLeft then exit;
p := Point(AX, AY);
index := GetIndexAtXY(AX, AY);
if index < 0 then exit;
R := ItemRect(index);
{$IFDEF DARWIN}
R.Left := 0;
R.Right := ClientWidth;
{$ENDIF}
CalcRects(R, rcb, ricon);
if (cloShowCheckboxes in Options) and IsPointInRect(p, rcb) then
ClickedCheckbox(index)
else if (cloShowIcons in Options) and IsPointInRect(p, ricon) then
// Remember clicked index for the double click event.
FSeriesIconClicked := index
else
ClickedItem(index);
finally
inherited MouseDown(AButton, AShift, AX, AY);
end;
end;
There is one disadvantage doing it this way: it is not possible to set the listbox into a multi-column mode (i.e. Columns property > 1). But I tested it and found that it does not seem to work on cocoa anyway. But please verify this with your macOS version: Drop a standard listbox on a form, add some items and set Columns to 2. Does the display change to two columns? If not we can keep above work-around.