nsoutlineview

Cocoa NSOutlineView and Drag-and-Drop

依然范特西╮ 提交于 2019-12-10 12:19:05
问题 I recently started another thread without an account, so I'm reposting the question here with an account so I can edit current links to the program so other users can follow this. I have also updated the code below. Here is my original question: I read the other post here on Outlineviews and DND, but I can't get my program to work. At the bottom of this post is a link to a zip of my project. Its very basic with only an outlineview and button. I want it to receive text files being dropped on

Building an NSOutline view with Check marks

一世执手 提交于 2019-12-10 11:08:59
问题 I am looking to add checkboxes to NSOutlineview using the correct Apple recommended method - however its not clear from the documentation. How do I add the behavour to allow users whereby if I click a parent checkbox, then it will select the children, and if I unclick it - it will deselect the children of that item? edit: I have simplified my question and added image to make it clearer ( hopefully) My Approach: I have been using the wonderful answer by Code Different to build an Outline view

NSTextFieldCell with Multiple Lines

℡╲_俬逩灬. 提交于 2019-12-09 17:46:33
问题 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? 回答1: 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

NSOutlineView indentation issue

依然范特西╮ 提交于 2019-12-08 21:02:10
问题 I'm using an NSOutlineView object to represent a file structure and am finding that it will not correctly indent any children which are expandable, though it will indent children that aren't. Here's a picture to show what I mean: In this example, "AnotherFolder" is a child of "Folder2" yet it does not indent in line with the other indented files. Curiously enough, the child "AnotherFile.java" of "AnotherFolder" does indent correctly (2 levels in). I have tried setting properties such as

Show list of strings in Source List (NSOutlineView) in Swift

孤者浪人 提交于 2019-12-08 13:26:59
问题 I'm trying to show a simple list of strings in a source list sidebar - similar to that in Finder or the Github app. From reading the protocol reference I can't see which method is setting what the view displays. So far I have: var items: [String] = ["Item 1", "Item 2", "Item is an item", "Thing"] func outlineView(outlineView: NSOutlineView, child index: Int, ofItem item: AnyObject?) -> AnyObject { return items[index] } func outlineView(outlineView: NSOutlineView, isItemExpandable item:

viewForTableColumn not being called for child items in view-based NSOutlineView

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-08 03:47:30
问题 I have an issue that the method -(NSView *)outlineView:(NSOutlineView *)outlineView viewForTableColumn:(NSTableColumn *)tableColumn item:(id)item; is not being called when the item isn't a group item. The methods -(BOOL)outlineView:(NSOutlineView *)outlineView isGroupItem:(id)item; -(BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item; are implemented to return YES for the (same and) correct set of header/group items. The following methods -(NSInteger)outlineView:

CALayer + NSOutlineView/NSTableView

梦想与她 提交于 2019-12-08 02:25:49
问题 Here is the issue: a view-based NSOutlineView (or NSTableView, both have the issue) contains a custom control hosting a CALayer, for custom animation purposes. When resizing the outline view, or after deleting rows (animated deletion), the CALayer draws at the wrong place. This is just after an horizontal resize (the gray square is the CALayer): This is just after deleting the row where the gray square is missing (the gray square is the CALayer): It looks like the CALayer is drawn a little

Should I use a background thread for my UI actions?

泄露秘密 提交于 2019-12-07 23:23:45
问题 Background I've got an NSOutlineView that shows TrainingGroup entities. Each TrainingGroup represents a folder on the local machine. The NSOutlineView is bound to an NSTreeController with a fetch predicate of IsTrained == 0 Each TrainingGroup can be assigned to a project. Each TrainingGroup has many TrainingEntries that show a time worked on that file. When the TrainingGroup is assigned to a project, the IsTrained is set to YES . On assign to a project, all descendants are also assigned to

Changing default font size for NSTable/NSOutlineView

我们两清 提交于 2019-12-07 22:38:22
问题 I dont quite understand how to change (decrease) the font size for the text in my NSOutlineView. The default text is larger than most applications use for their font size. There is some heirachical thing where you dont set the font directory but you inherit from something "above" the table or outline view. Is there anywhere that neatly explains this? 回答1: NSOutlineView is a sublcass of NSTableView . So an outline view also has columns, each of which has its own cell associated with it. The

Data for NSOutlineView Source List

我的梦境 提交于 2019-12-07 18:01:50
问题 i've got a Delegate class for a Source List. But i don't know what type the return variable of outlineView:objectValueForTableColumn:byItem: should be. At the Moment my code looks like this, all the structure things work but there is no text shown: @interface DataSource : NSObject<NSOutlineViewDelegate,NSOutlineViewDataSource> @end And the .m @implementation DataSource // Data Source methods - (NSInteger)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item { return (item =