nsoutlineview

Shaving a couple levels of indentation off of an NSOutlineView

本秂侑毒 提交于 2019-12-05 07:13:51
I have an outline view where I don't want to indent the top couple levels (they have a distinctive appearance anyway), but I do want to indent subsequent levels. How can I do this? I've tried overriding -levelForRow: and -levelForItem: to subtract 2 from the return values, but this didn't help. I also tried overriding -frameOfOutlineCellAtRow: to subtract 2 * indentationPerLevel from the frame's width, but that didn't help either, possibly because I'm not showing disclosure triangles. Any thoughts about how I can fix this issue? The outline view is bound to an NSTreeController , which makes it

Creating a simple NSOutlineView datasource with MonoMac

a 夏天 提交于 2019-12-05 06:08:44
I cant seem to figure out how to create a simple NSOutlineView with 2 columns, and a datastructure that is more than 1 level deep (a hierachy). I've been researching this for days, and all I can find is Objective C examples, which I really can't use for anything. I understand there are different patterns for doing this, one being the DataSource pattern. I tried creating a class that inherited from NSOutlineViewDataSource, however thats all I got, I have no clue on what I should do next! Lets say I would like to display the following class in my NSOutlineView: public class Person { public

Swift code to use NSOutlineView as file system directory browser

醉酒当歌 提交于 2019-12-05 04:50:21
问题 I'm struggling with this Swift code already for some time and do not find the problem. The code below should provide the File Directory as DataSource for a NSOutlineView. The GUI is quite simple just a window with a NSOutlineView and a Object for the OutlineViewController instance. When I start the application it shows the root entry, when I expand the root entry it shows for a short period the sub items. Then the application crashes with an Error in file "main.swift" at line

Drag and drop from within a NSOutlineView

本秂侑毒 提交于 2019-12-05 04:06:02
I'm trying to figure out how to implement drag and drop from within a NSOutlineView to itself. For example, I want the user to be able to reorder and nest and re-nest the items in the NSOutlineView, but I don't need to be able to drag items from any other source (like files or from another view). All the examples I can find deal with dragging item into the NSOutlineView, not just within itself and seem overly complex. I assume this is possible. Can someone point be to some docs that deal with just this case? Maybe I'm just missing the obvious. I have found the documentation of this to be

View-based NSOutlineview selection gradient

烈酒焚心 提交于 2019-12-05 00:30:17
问题 I'm still struggling with the view-based NSOutlineView in my little Cocoa application. I'm trying model my OutlineView after the finder one. When the Finder OutlineView loses focus (e.g. clicking any folder on the right side), the selected row (e.g. Desktop) stays selected with the bright blue gradient and does not change to the inactive blue-grey gradient. I'd like to duplicate this behaviour in my application. In a not view-based OutlineView I was able to subclass NSOutlineView and

View-based NSOutlineView header cell font issues

自作多情 提交于 2019-12-04 12:36:47
问题 I'm currently trying to use a new view-based NSOutlineView in my Cocoa app. As I'm not using bindings, so I implemented all required delegate and datasource methods in my controller. In interface builder I've added a NSOutlineView with a highlighting set to SourceList and Content Mode set to View Based . Thus, there were two default table cell views provided (one Header cell with HeaderCell set as identifier and one data cell with DataCell set as identifier) This is what it looks like in

Delegate events for NSTextField in a view-based NSOutlineView?

左心房为你撑大大i 提交于 2019-12-04 11:25:33
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 the delegate method outlineView:setObjectValue:forTableColumn:byItem: however it's not available for a view-based NSOutlineView as stated in the header file for the NSOutlineViewData protocol: /* View Based OutlineView: This method is not applicable. */ (void)outlineView:(NSOutlineView *)outlineView setObjectValue:(id)object forTableColumn:

NSTextFieldCell with Multiple Lines

半世苍凉 提交于 2019-12-04 07:39:56
I need to show an NSTextFieldCell with multiple lines with different format on each line. Something like this: Line 1: Title Line 2: Description I subclassed NSTextFieldCell but I don't know how to go on with it. Any ideas? NSGod First off, you don't have to subclass NSTextFieldCell to achieve this, since, as a subclass of NSCell , NSTextFieldCell inherits -setAttributedStringValue: . The string you provided can be represented as a NSAttributedString . The following code illustrates how you could achieve the desired text with an ordinary NSTextField . MDAppController.h: @interface

NSOulineView header cell font

跟風遠走 提交于 2019-12-04 05:20:00
问题 I'm trying to reduce the font size of the Header Cell in a NSOutlineView (source-list view-based). The problem is that using IB doesn't work for me (both modifying the font for NSTextField and NSTextFieldCell ). The views are returned by outlineView:viewForTableColumn:item: using makeViewWithIdentifier:owner: Any ideas? 回答1: These steps solved the problem. 1) Select the NSOutlineView in IB. 2) In the Size Inspector select Automatic for Size Style . If it is already selected, deselect and

Swift code to use NSOutlineView as file system directory browser

放肆的年华 提交于 2019-12-03 21:18:27
I'm struggling with this Swift code already for some time and do not find the problem. The code below should provide the File Directory as DataSource for a NSOutlineView. The GUI is quite simple just a window with a NSOutlineView and a Object for the OutlineViewController instance. When I start the application it shows the root entry, when I expand the root entry it shows for a short period the sub items. Then the application crashes with an Error in file "main.swift" at line "NSApplicationMain(C_ARGC, C_ARGV) --> "EXC_BAD_ACCESS(code=EXC_I386_GPFLT)" ? If added some println() to proof the