Re: How can I get horizontal scrollbars adequate to the widest list entry
Re: How can I get horizontal scrollbars adequate to the widest list entry
- Subject: Re: How can I get horizontal scrollbars adequate to the widest list entry
- From: Steven Mills via Cocoa-dev <email@hidden>
- Date: Wed, 11 Nov 2020 09:51:15 -0600
On Nov 11, 2020, at 09:38:37, Andreas Falkenhahn <email@hidden> 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 (email@hidden)
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:
This email sent to email@hidden