diff -r 504c45926386 -r f8ff8df41713 ui/cocoa/GridLayout.m --- a/ui/cocoa/GridLayout.m Sat Oct 04 18:33:58 2025 +0200 +++ b/ui/cocoa/GridLayout.m Sun Oct 05 12:34:42 2025 +0200 @@ -184,17 +184,23 @@ int preferred_width = 0; int preferred_height = 0; for(int j=0;j 0) { + preferred_width += (ncols-1) * colspacing; + } + if(nrows > 0) { + preferred_height += (nrows-1) * rowspacing; + } _preferredSize.width = preferred_width; _preferredSize.height = preferred_height; @@ -292,7 +298,7 @@ return self.preferredSize; } -- (void) addView:(NSView*)view { +- (void) addView:(NSView*)view margin:(NSEdgeInsets)margin { _preferredSize.width = -1; _preferredSize.height = -1; @@ -305,7 +311,7 @@ GridElm elm; elm.x = _x; elm.y = _y; - elm.margin = 0; + elm.margin = margin; elm.colspan = _uilayout.colspan; elm.rowspan = _uilayout.rowspan; if(_uilayout.fill) {