Indenting NSOutlineView Problem

I use the NSOutlineView object to represent the file structure and believe that it will not correctly indent any children that can expand, although these will be indents for children who do not.

Here is an image to show what I mean:

NSOutlineView example

In this example, "AnotherFolder" is a child of "Folder2", but it does not indent according to other indentation files. Oddly enough, the child "AnotherFile.java" from "AnotherFolder" indent correctly (2 levels).

I tried setting properties like "indentationFollowsCells" to no avail. It seems to be very simple, but I can't solve it.

Thanks!

Edit: Additional information on request:

I am using NSOutlineViewDataSource protocol for implementation, here is the code related to this:

- (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item { return item; } - (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index ofItem:(id)item { NSMutableDictionary* dict; if(item == nil) { dict = fileTree; } else { dict = [((MyFile*) item) children]; } NSArray* keys = [dict allKeys]; NSArray* sorted = [keys sortedArrayUsingSelector:@selector(compare:)]; NSString* key = [sorted objectAtIndex:index]; return [dict objectForKey:key]; } - (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item { return [[item children] count] > 0; } - (NSInteger)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item { if(item == nil) { return [fileTree count]; } return [[item children] count]; } 
+6
source share
1 answer

Try changing the appearance of the path from the Source path to the normal one.

+6
source

Source: https://habr.com/ru/post/894524/


All Articles