On Nov 11, 2020, at 09:38:37, Andreas Falkenhahn <andr...@falkenhahn.com> wrote: > > > Ok, but how can I get those distances? I've tried the following: > > NSView *view = [tableView viewAtColumn:0 row:idx makeIfNecessary:YES]; > NSRect bounds = [view bounds]; > > But bounds.origin.x and bounds.size.width are always 0...
Did you try my other suggestions first? If the layout system can handle this for you, then your work is done. You also need to learn how view coordinates work. A view's bounds will almost always have an origin of 0,0. What you want is the view's frame, which is the rectangle of the view as seen by its superview. The field's left offset in its superview is field.frame.origin.x. The field's right offset in its superview is field.superview.frame.size.width - NSMaxX(field.frame). Add those 2 values to the widest measured string width. But really, you should look into the constraint suggestions first. Constraints are powerful and make your job much easier once you learn how they work. -- Steve Mills Drummer, Mac geek _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com