With macOS 11 and more, the OS added a large leading margin to the NSTableView, which is the base component for Lazarus TListBox, TCheckListBox, TListView, and probably others.
The change is described
https://wiki.freepascal.org/macOS_Big_Sur_changes_for_developers#Table_Views and shown below.
The new default style value uses the widest spacing available, and is quite excessive. This can be brought back to normal with the following code changes.
In
/Applications/Lazarus/lcl/interfaces/cocoa/cocoa_extra.pas add or change to this:
const
// 11.0
NSTableViewStyleAutomatic = 0;
NSTableViewStyleFullWidth = 1;
NSTableViewStyleInset = 2;
NSTableViewStyleSourceList = 3;
NSTableViewStylePlain = 4;
type
NSTableViewStyle = NSInteger; // 11.0
NSTableViewFix = objccategory external (NSTableView)
// 11.0
procedure setStyle(newValue: NSTableViewStyle); message 'setStyle:';
function style: NSTableViewStyle; message 'style';
function effectiveStyle: NSTableViewStyle; message 'effectiveStyle';
end;
In
/Applications/Lazarus/lcl/interfaces/cocoa/cocoatables.pas adjust existing function to read
function TCocoaTableListView.initWithFrame(frameRect: NSRect): id;
begin
Result:=inherited initWithFrame(frameRect);
// 11.0 - fix for column alignment
if (NSAppkitVersionNumber >= NSAppKitVersionNumber11_0) then
setStyle(NSTableViewStyleFullWidth);
end;
Below is images from the sample apps showing before / after the fix.