nstableview

Automatically adjust size of NSTableView

你说的曾经没有我的故事 提交于 2019-12-06 04:47:12
问题 I have an NSTableView, which should resize it's frame when a row is added. I would make 2 properties, maxHeight and minHeight, and if any rows are being added or removed, I would resize the table view to fit it's content, if it doesn't cross the limit. Like the Safari Download Panel (10.7 or later). Has anyone an idea how to do this? I would want to handle this in a subclass. So no messing with the resizing in the delegate class. I would at least need to know which method is being called when

Looking for a spreadsheet-like control for Cocoa

醉酒当歌 提交于 2019-12-06 04:47:10
问题 I'm looking for a grid view / table view / spreadsheet-type control for Cocoa and can't seem to find anything that's in any reasonable state. I've tried using NSTableView but it's not really meant to be a single cell control. NSCollectionView doesn't seem to be right either. Any ideas? 回答1: While Matt Ball's spreadsheet view (https://github.com/mattball/mbtablegrid/, mentioned above) is several years old, it does still compile on El Capitan. It must be easier as a starting point than working

How to trigger an action from a NSTableCellView in view based NSTableView when using bindings

人盡茶涼 提交于 2019-12-06 03:20:59
问题 I'm facing a problem with a view-based NSTableView running on 10.8 (target is 10.7, but I think this is not relevant). I'm using an NSTableView, and I get content values for my custom NSTableCellView through bindings. I use the obejctValue of the NSTableCellView to get my data. I added a button to my cell, and I'd like it to trigger some action when clicked. So far I have only been able to trigger an action within the custom NSTableCellView's subclass. I can get the row that was clicked like

Swift & NSTableView - Simply select a row

杀马特。学长 韩版系。学妹 提交于 2019-12-06 03:01:03
问题 I'd like to programatically select a row in my NSTableView, with just one column. func selectColumnIndexes(_ indexes: NSIndexSet!, byExtendingSelection extend: Bool) I have been playing around with this, but I am not sure how to write "Select row #2". Do I have to start with the variable connected to the @IBOutlet of my Table View? I have to indicate it is about my NSTableView somehow. Thanks! 回答1: Swift 4 Solution I created an extension to make a little easier to do this. Also if you

Draw a custom NSTableRowView depending on if next row is group row

☆樱花仙子☆ 提交于 2019-12-06 02:30:03
问题 I have a custom NSTableRowView implementation to display my data cells. The table also contains group rows using a simple NSTextField . In my custom row view I need to change the drawing of the bottom separator slightly depending on if the next row below is a data cell (i.e. my custom row) or a group header. In the case of a group header I don't have to draw the separator, otherwise I'll end up with a 2px separator like shown in the screenshot. Is there a way to get a reference to the next

NSTableView: blue outline on right-clicked rows

淺唱寂寞╮ 提交于 2019-12-06 02:05:04
问题 I'm wondering how I can get rid of the blue outlines that Cocoa draws around rows in NSTableView / NSOutlineView when right-clicking on them. NSTableView Outline http://tobidobi.com/nstableview_outline.png It doesn't seem to be a classic "highlight" nor a "focus ring" if I'm not mistaken - so, what is it, actually? I'm currently drawing custom NSCells completely myself - but I can't figure out how to either * draw this outline by myself, too, or * get rid of it, or * at least change its

How to make NSTableView not reuse TableCellViews

给你一囗甜甜゛ 提交于 2019-12-06 01:28:27
问题 I would like my view-based-NSTableview to not reuse previously generated TableCellViews that are scrolled out of scope. I figure that this would be possible with UITableView by overwriting dequeueReusableCellWithIdentifier: to return nil. Ist there is similar solution for NSTableView? - My Background: I have a quite complex view-based-tableView bound to ManagedObjects in the usual way (i.e. table-content, -selection and -sortdescriptor are bound to an arraycontroller and the tableCellView

Realm + NSTableView + NSArrayController

故事扮演 提交于 2019-12-05 21:58:07
i have some Problems with my macOS Application and hope you can help me. Im pretty new on macOS so please be nice ;) A part of the app consists of a simple NSTableView which content is binded to an NSArrayController. The NSArrayController is feeded from a realm database. As you can see there is a checkbox for each row, which should set the bool value in the realm object. The bindings are ok, so if I mark/unmark the checkbox it seems to try writing on the realm object. But since realm needs a active write transaction, which will not be triggered, it crashes. My Question is: How can I write on

Create group rows in NSTableView using CoreData backed NSArrayController

丶灬走出姿态 提交于 2019-12-05 21:18:00
问题 Say I have a bunch of Article objects stored within the core data model. Each article maintains, a reading progress attribute which denotes how much of the article has been read by the user. Once the user has read the article fully, the article is marked as "Read". Before that, it would be marked "Unread". Now I have an NSTableView bound to a NSArrayController containing all the Article objects stored using CoreData. I want it to display all unread articles under an "Unread" group, and all

View and Cell based NSTableView

爷,独闯天下 提交于 2019-12-05 18:20:57
What is the main difference between cell based and view based tableviews in Cocoa. The understanding I have is cell based tableviews are basically used for displaying strings and view based are for custom cells.User events such as dragging rows, selection etc can be handled in view based. cell based tableviews use objectValueForTableColumn: method and view based tables use viewForTableColumn: method. Is my understanding correct?. Or is any other design concerns between these table views. When to go for cell based and when to go for view based. Thanks in advance short answer: A cell can contain