Re: How can I get horizontal scrollbars adequate to the widest list entry

2020-11-14 Thread Andreas Falkenhahn via Cocoa-dev
So just for the record, thanks to a hint from Stack Overflow I was able to solve the problem by just using ceil() on the size I get from [cell cellSize]. Maybe just passing [cell cellSize].width as a CGFloat to NSTableColumn::setWidth() would also do the job but I haven't tested this because my

Re: How can I get horizontal scrollbars adequate to the widest list entry

2020-11-11 Thread Steven Mills via Cocoa-dev
On Nov 11, 2020, at 10:13:35, Andreas Falkenhahn wrote: > > Yeah, but size.width is 0 too so something must be wrong in that code... Does it even have a superview at that point? I kinda think it doesn't, because the method you're in is supposed to return the cell view that the table will then

Re: How can I get horizontal scrollbars adequate to the widest list entry

2020-11-11 Thread Andreas Falkenhahn via Cocoa-dev
On 11.11.2020 at 16:51 Steven Mills via Cocoa-dev wrote: > You also need to learn how view coordinates work. A view's bounds > will almost always have an origin of 0,0. Yeah, but size.width is 0 too so something must be wrong in that code... > What you want is the > view's frame, which is the r

Re: How can I get horizontal scrollbars adequate to the widest list entry

2020-11-11 Thread Steven Mills via Cocoa-dev
On Nov 11, 2020, at 09:38:37, Andreas Falkenhahn 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 alw

Re: How can I get horizontal scrollbars adequate to the widest list entry

2020-11-11 Thread Andreas Falkenhahn via Cocoa-dev
> Yes, just add a fudge factor to ensure the column will be wide > enough to accommodate the string width AND the spacing between the > left and right edges of the actual NSTextField in the cell. You can > inspect the field in the table to see those distances. Ok, but how can I get those distances

Re: How can I get horizontal scrollbars adequate to the widest list entry

2020-11-11 Thread Steven Mills via Cocoa-dev
On Nov 11, 2020, at 08:54:02, Andreas Falkenhahn via Cocoa-dev wrote: > > However, this still isn't perfect because the last two characters of the > widest entry are still cut off and replaced by "...". Of course, I can solve > this by just adding something a few points to size.width but of co

How can I get horizontal scrollbars adequate to the widest list entry

2020-11-11 Thread Andreas Falkenhahn via Cocoa-dev
I have a simple one-column NSTableView full of text. When I add very long lines to it, the text that doesn't fit into the column gets cut off and replaced by "...". I don't want that. Instead, I want to have a horizontal scrollbar that allows the user to view the complete list entry. Sounds sim