nstableview

Respond to mouse events in text field in view-based table view

落花浮王杯 提交于 2019-12-17 15:29:50
问题 I have text fields inside a custom view inside an NSOutlineView . Editing one of these cells requires a single click, a pause, and another single click. The first single click selects the table view row, and the second single click draws the cursor in the field. Double-clicking the cell, which lets you edit in a cell-based table view, only selects the row. The behavior I want: one click to change the selection and edit. What do I need to override to obtain this behavior? I've read some other

How to learn in Swift inside 'tableViewSelectionDidChange:' in which NSTableView the selection did change?

浪子不回头ぞ 提交于 2019-12-13 17:20:07
问题 I have a macOS project where there are two tableView with the same viewControl as delegate. How can I learn which of the two is called on tableViewSelectionDidChange:? EDIT: I'm using tableViewSelectionDidChange: to prevent some items I use as a sort of "title group" from being clicked. I read this question NSTableViewDelegate with 2 tables and tableViewSelectionDidChange:(NSNotification *)aNotification but being a beginner, I don't know how to do this in Swift. I tried func

NSTableView Drag and Drop not working

橙三吉。 提交于 2019-12-13 14:15:00
问题 I'm trying to set up very basic drag and drop for my NSTableView. The table view has a single column (with a custom cell). The column is bound to an NSArrayController, and the array controller's content array is bound to an NSArray on my controller object. The data displays fine in the table. I connected the dataSource and delegate outlets of the table view to my controller object, and then implemented these methods: - (BOOL)tableView:(NSTableView *)aTableView writeRowsWithIndexes:(NSIndexSet

Weird rectangle (NSBannerView) in left top of NSTableView

断了今生、忘了曾经 提交于 2019-12-13 13:42:30
问题 I'm working on an macOS app and I'm experiencing a weird issue. In the left top corner of my NSTableView (above the header), a grey rectangle is shown: (I've added an NSBox behind the NSTableView to make it more clear in the screenshot) With the Debug View Hierarchy, I've seen it's an NSBannerView which is added to the Scroll View wrapping the Table View. My UI is built with Interface Builder (a storyboard). I've checked and unchecked lots of checkboxes in the Interface Builder but can't find

Embedding NSStackView as NSTableCellView in NSTableView

那年仲夏 提交于 2019-12-13 06:31:42
问题 I'm currently working on a prototype for a todo type app. I have a table which contains the user tasks. What I want to do is only present the user with pertinent task information. But to edit additional information, they would click on a disclosure button to expand the cell. I was thinking of two possible ways to handle this: Expanding NSTableViewCell Using an NSStackView as the contents of each cell If using the NSTableViewCell, I would probably have two NSViews to represent the cell (top

NSTableCellView Image View action

三世轮回 提交于 2019-12-13 06:17:12
问题 I need to call catch action of ImageView inside NSTableCellView. I add some action for it, but when I click the row action is not called... I have set accept touch event property true, but no result PatientTableView.AcceptsTouchEvents = true; 回答1: image view does not support click action (use NSButton for that). It does support an action when a user drags an image on to it (if the imageview is set to editable). Never used this thought. I never use actions in xcode. But always subscribe to an

What is the proper way to bind cell views to model objects in NSTableView / UITableView

那年仲夏 提交于 2019-12-13 05:53:20
问题 I have constructed a view-based NSTableView, programmatically (code-only, without XIB) following this, which is backed by an NSArrayController, created simply by: var controller = NSArrayController() and bound to the table by: tableView.bind(NSContentBinding, toObject: controller, withKeyPath: "arrangedObjects", options: nil) tableView.bind(NSSelectionIndexesBinding, toObject: controller, withKeyPath:"selectionIndexes", options: nil) tableView.bind(NSSortDescriptorsBinding, toObject:

NSOutlineView and Core Data 1 → Many Relationships

 ̄綄美尐妖づ 提交于 2019-12-13 05:35:17
问题 I have a Core Data model that supports a 1 → Many relationship (1 Folder to many Phrases). At the moment I'm just displaying the Phrases on a flat NSTableView using Core Data Bindings to a NSArrayController to glue everything together - this is working happily. I'm trying to experiment with an NSOutlineView to achieve the same result but showing the folders as well. I've tried a similar binding structure that I'm already using with the NSTableView but I'm not making any headway. What steps

Ongoing NSTableView problems

心已入冬 提交于 2019-12-13 03:58:36
问题 I am writing my first Cocoa/OSX app. I have been having problems with an NSTableView derived class. The problems is that there is no table in the containing NSView - the table is not visible. I previously pasted my code at NSTableView is not being displayed If you know NSTableView well and it could assist, it would greatly help. I have spent a couple of days on this, with no luck. Additional details: NSLog shows that NSTableView subclass init() is called once. This is probably good. The

Using NSTableView insertRowsAtIndexes

丶灬走出姿态 提交于 2019-12-13 03:05:41
问题 I'm trying to add rows to my NSTableView dynamically using NSTableView::insertRowsAtIndexes:withAnimation To do so, I update the contents of the NSArray that holds my data source, and then [myTableView beginUpdates]; NSRange theRange = NSMakeRange(0, [self.myTableContents count]-1); NSIndexSet* theIndexSet = [NSIndexSet indexSetWithIndexesInRange:theRange]; [myTableView insertRowsAtIndexes:theIndexSet withAnimation:NSTableViewAnimationEffectFade]; [myTableView endUpdates]; My problem is that