Questions tagged [nsoutlineview]

NSOutlineView is a subclass of NSTableView that uses a row-and-column format to display hierarchical data that can be expanded and collapsed, such as directories and files in a file system. A user can expand and collapse rows, edit values, and resize and rearrange columns.

Like a table view, an outline view does not store its own data, instead it retrieves data values as needed from a data source to which it has a weak reference (see Communicating With Objects). See the NSOutlineViewDataSource protocol, which declares the methods that an NSOutlineView object uses to access the contents of its data source object.

An outline view has the following features:

  • A user can expand and collapse rows.

  • Each item in the outline view must be unique. In order for the collapsed state to remain consistent between reloads the item's pointer must remain the same.

  • The view gets data from a data source (see the NSOutlineViewDataSource protocol).

  • The view retrieves only the data that needs to be displayed.

659 questions
4
votes
1 answer

Clean way to get the NSIndexPath of an object in an NSTreeController or NSOutlineView?

After poring through the documentation, I can find no reasonably easy way to get the index path of an object in an NSOutlineView or the NSTreeController it's bound to. As a result, I've ended up writing really ugly code trying to assemble an index…
John Wells
  • 1,139
  • 1
  • 10
  • 27
4
votes
2 answers

Delegate events for NSTextField in a view-based NSOutlineView?

I have a flawless functioning view-based NSOutlineView with a proper set-up datasource in my project. Now I want to allow the user to change certain entries. So I made the NSTextField in the IB editable. For a cell-based NSOutlineView you can use…
Paul
  • 1,295
  • 2
  • 11
  • 26
4
votes
1 answer

NSOutlineView adding NSBannerView to grouped rows

New in macOS Mojave, there's a NSBannerView (NSVisualEffectView) that gets inserted behind the actual cell view in each row marked as a Grouped Row. This is adding an unnecessary visual effect-view that ruins the already styled row for our purpose.…
strangetimes
  • 4,953
  • 1
  • 34
  • 62
4
votes
5 answers

NSOutlineView Changing disclosure Image

I my outline view, i am adding Custom cell, To drawing custom cell, i am referring example code , present in the Cocoa documentation http://www.martinkahr.com/2007/05/04/nscell-image-and-text-sample/ I want to change the disclosure image of the cell…
Amitg2k12
  • 3,765
  • 10
  • 48
  • 97
4
votes
1 answer

Blue border appearing around NSScrollView

I'm sure this is normal and I'm just misunderstanding something, but since making one of my NSScrollViews slightly inset from the bottom of the window (as opposed to taking the full height), a blue border has appeared around it. I've set NSNoBorder…
d11wtq
  • 34,788
  • 19
  • 120
  • 195
4
votes
1 answer

Programmatically binding NSTreeController to NSOutlineView

To support a different language than Swift and ObjC, I need to understand how to set up an NSTreeController for an NSOutlineView. I have already been able to create the NSOutlineView in code, along with providing my own DataSource delegate. But now…
Thomas Tempelmann
  • 11,045
  • 8
  • 74
  • 149
4
votes
3 answers

NSOutlineView with badge of unread messages like Mail.app

I'm trying to create a user interface similar to the iTunes source list or the Mail.app mailbox list where a badge with a number (e.g. unread emails, new podcasts) is shown at the right hand side of an element. Based on Apple's SourceList example, I…
Mark
  • 1,447
  • 2
  • 14
  • 26
4
votes
0 answers

NSOutlineView reloadData is crashing

I have an NSOutlineView for which I do a reloadData: [myOutlineView reloadData]; myOutlineView is bound from InterfaceBuilder. This works fine on my computer but not on a beta testers to which machine I have no access. His crashlog shows…
Laurent Crivello
  • 3,809
  • 6
  • 45
  • 89
4
votes
1 answer

Make NSFormatter validate NSTextFieldCell continuously

In Cocoa, I have an NSOutlineView where the cells are NSTextFieldCell. The cell displays values which are strings that are formatted according to certain rules (such as floats or pairs of floats with a space in between). I have made a custom…
harms
  • 8,728
  • 4
  • 30
  • 27
4
votes
1 answer

NSOutlineViewDataSource and Swift

I'm trying to implement a NSOutlineViewDataSource with Swift and when using Swift strings the app is simply crashing. When I change the array people to be of NSString it works fine. According to Working with Cocoa Data Types the string bridging…
Adriano Bonat
  • 90
  • 1
  • 7
4
votes
0 answers

Why does [[NSTableCellView alloc] init] produce a nil- text field?

The log lines below will show "Table cell: [valid value logged here]" but "Text field: (null)". I'm actually trying to build an NSOutlineView programmatically, and it works with a cell-based approach, but not with a view-based approach. Can someone…
magnus
  • 4,031
  • 7
  • 26
  • 48
4
votes
1 answer

NSOutlineView in NSPopover not readable in OSX 10.10 Yosemite

I have a NSPopover containing a NSOutlineView (source list) that is displayed over a usually dark background (but it's not always dark). The NSOutlineView has a transparent background to blend nicely with the NSPopover view. This looked great in OS…
rasmus
  • 3,136
  • 17
  • 22
4
votes
1 answer

How to invert icons when selected in NSOutlineView or NSTableView

In my App I use icons within a NSOutlineView and NSTableView (through NSImageCell). The icons look fine, but when the row is selected the icons aren't visible very well: In Finder, for example the selected icon gets a white negative: How can I…
Besi
  • 22,579
  • 24
  • 131
  • 223
4
votes
0 answers

How to ensure NSOutlineView inside a custom view renders full height (without scrolling)

I have a window with two custom views stacked on top of each other. I use auto layout constraints, as follows: Top view leading, top, and trailing edges are tied to superview. Bottom view leading, bottom, and trailing edges are tied to…
Michael Teper
  • 4,591
  • 2
  • 32
  • 49
4
votes
1 answer

NSOutlineView with source list highlighting not indenting second level

I ran into a very strange problem: I have an NSOutlineView set to NSTableViewSelectionHighlightStyleSourceList. Under certain conditions, the second level is not indented and shown at the same level as the root node. I believe that is, because the…
Mark
  • 6,647
  • 1
  • 45
  • 88