nstableview

How to retrieve the current selection of an NSPopUpButtonCell?

拥有回忆 提交于 2019-12-13 02:08:31
问题 I am using an NSPopUpButtonCell in an NSTableView . The popup button has a binding to an NSArray property offered by the ApplicationDelegate . When I select a menu item of the popup button I expect to retrieve the current selection or its index . I added an IBAction to being informed and also set up an NSMenuDelegate . Both return index = 0 at all times. // indexOfSelectedItem is always 0. NSInteger indexOfSelectedItem = [m_popUpButtonCell indexOfSelectedItem]; I created an example project

View-based NSTableView renders blank rows after inserting new rows with animation

五迷三道 提交于 2019-12-12 09:52:56
问题 I have a view-based NSTableView that I'm backing with an `NSMutableArray . Periodically I go out grab some data and want to insert new rows into the table at the top. When I do this without specifying an animation to insertRowsAtIndexes:withAnimation: it seems to work fine for hours on end. However, if I specify an animation, after about 7 or 8 inserts the table view starts to show blank rows where the inserts occurred. Scrolling down and then back up causes the new rows to render properly.

How to handle NSTableView Drag and Drop for multiple rows

心不动则不痛 提交于 2019-12-12 09:02:23
问题 I'm fairly new to Cocoa dev, but implementing single row drag and drop within my NSTableView was fairly straightforward. However I'm now having a hard time getting it to work right when multiple rows are selected. It seems to work without fault when all the selected rows are sequential, but it fails when, for example, you select rows 0 and 4 (where 4 is the last row) and drag them to somewhere in between (such as row 1 or 2) — by fail I mean that the wrong row is deleted and so I end up with

In a view-based NSTableView, how make a control the first responder with a single click?

半腔热情 提交于 2019-12-12 08:39:50
问题 View-based NSTableViews seem to have just the standard behavior, where, in order to make a text field inside the table the first responder, the user has to either double click or to single click and "keep calm". However, given the flexibility view-based NSTableViews offer, this behavior is not not always desirable since there are now much different and complex applications possible than just doing an "old school" table. How can I easily make a control (possibly in a cell together with other

Sectioned NSTableView using NSArrayController

你。 提交于 2019-12-12 07:49:32
问题 I'm trying to create a sectioned NSTableView using NSArrayController and cocoa bindings. I'm searching for a similar approach like with NSFetchedResultsController in iOS, where you can set a section key path. I want to make something similar with NSArrayController . I give you an example: I have different tasks. Each task has one of three different priorities, low, medium or high. The tasks also has attributes like title, description, date, etc. I want to section or group the tasks by

NSTableView reloadData leaking memory

╄→尐↘猪︶ㄣ 提交于 2019-12-12 04:42:01
问题 I've been checking my application for leaks using the Instruments application. Under a certain set of circumstances a table view in a HUD Panel is being updated once a second. It is all working fine except every second (reloadData) the number of _NSArrayl objects increases by one. If I change my datasource to just a return(@""); (they are all text cells) then the problem stays (no change). If I remove all my surrounding code to just: [myTableView reloadData]; and - (id)tableView:(NSTableView

How does updating NSTableView from this mutable array work in Cocoa?

邮差的信 提交于 2019-12-12 04:09:47
问题 In my application, I have an NSTableView which should contain a list of files. I have a button that is used to open an dialog and programmatically add files to this list. For some time, I could not get the table view to update when I was adding files, as I was using the following code: [self.newPackage.files addObject:fileURL]; It makes sense to me now that this doesn't work. As I understand it, the above line of code would be changing the mutable array "behind the controller's back." I was

NSTableViewCell setSelected?

寵の児 提交于 2019-12-12 03:17:31
问题 How do I communicate between my NSViewController and the NSTableViewCell when I select that cell on my tableView? On iOS you could use setSelected but in OSX it is totally different. The NSTableCellView class doesn't have any function like that. I might be missing something simple. How do I talk with that cell? I have a custom class cell and on my tableView controller, I got: func tableView(tableView: NSTableView, shouldSelectRow row: Int) -> Bool { let previousSelected = NSIndexSet(index:

Button with IBAction causes “Could not connect action, target class NSNibExternalObjectPlaceholder does not respond to -action” error

一个人想着一个人 提交于 2019-12-12 02:37:06
问题 I have a Storyboard scene which contains an NSTableView with an NSTableViewRow subclass. In this table view row, I have a button which I have wired up to an action in the view controller on the scene. When the table loads, I am seeing this cryptic error from Xcode and the action never fires when I click the button: Could not connect action, target class NSNibExternalObjectPlaceholder does not respond to -playVideo: It looks like the file's owner never gets wired up. Since these

NSTableView: selecting non-editable CELLS and not ROWS

两盒软妹~` 提交于 2019-12-11 19:43:48
问题 I've tried numerous combinations of suggested options from other posts, but I can't seem to get a cell-bassed NSTableView populated with non-editable NSTextFieldCell to select the CELL and not the row. I've tried: [[col dataCell] setEditable:NO]; [[col dataCell] setSelectable:YES]; [col setEditable:YES]; and tried delegates: - (BOOL)tableView:(NSTableView *)aTableView shouldSelectRow:(NSInteger)rowIndex; and - (BOOL)shouldFocusCell:(NSCell *)cell atColumn:(NSInteger)column row:(NSInteger)row;