nstableview

Double click an NSTableView row in Cocoa?

ⅰ亾dé卋堺 提交于 2019-11-28 16:56:36
I need my application to open a window when a user double clicks on a row in an NSTableView . I'm having a bit of a difficult time finding information or examples on how to accomplish this. Can anybody point me in the right direction? Take a look at the -setDoubleAction: method on NSTableView; you can set that to a method that will be called just like the normal target-action system but on a double-click. In that action method, -clickedRow will be useful. amateur barista Adding more basic information to @JimPuls answer for the benefit of other newcomers to Cocoa. An IBOutlet to the NSTableView

Programmatically creating an NSTableView (trouble getting the NSHeaderView to show up)(cocoa osx)

折月煮酒 提交于 2019-11-28 16:44:48
问题 I am making an NSTableView programmatically but for some reason no matter what I do, I cannot make the darn headerView show up. It is imperative that I do this programmatically and not use the IB because I am actually developing this widget in an IDE called clozure cl which is a lisp ide that includes a cocoa bridge. Originally I thought this problem might have been caused by my development environement but I just created an example in Xcode using only objective C and it seems that the

NSTableView's viewForTableColumn:row: called for more rows than expected in Mavericks

…衆ロ難τιáo~ 提交于 2019-11-28 12:42:24
My understanding was that viewForTableColumn:row: would be called only for rows that are visible. I confirmed this using the following: NSRange rowsInRect = [aTableView rowsInRect:[aTableView visibleRect]]; NSInteger lastVisibleRow = rowsInRect.location + rowsInRect.length; But with Mavericks, viewForTableColumn:row is getting called many more times without scrolling down. For example, if my last visible row was 35, data source method is called for 139 rows. Can anybody explain this? I found the explanation to this in AppKit Release notes for OS X v10.9. Here goes: Mac OS 10.9 has a new

NSTableView - select row and respond to mouse events immediately [duplicate]

孤人 提交于 2019-11-28 10:34:05
This question already has an answer here: Respond to mouse events in text field in view-based table view 5 answers I have a view based NSTableView in which the cells contain a number of controls including text fields and edit fields. When a user tries to click on a control within a cell in order to, for example, start editing a text field, the click's main objective is ignored and the cell gets selected. Another click is then needed to perform the action originally intended, and even this click is subject to a delay before it's taken into account. How can I avoid this problem and have the row

View based NSTableView editing

早过忘川 提交于 2019-11-28 06:29:19
I'm not sure what I'm doing wrong. Since I couldn't find any other questions (or even documentation) about this, it seems do be normally working without problems for other people. I'm simply trying to get a view based NSTableView to do support editing of it's content. I.e. the app displays a NSTableView with one column and several rows, containing a NSTextField with some content. I want to be able to (double) click on a cell and edit the cell's content. So basically the normal behavior of a cell based NSTableView where the tableView:setObjectValue:forTableColumn:row: method is implemented. I

NSTableView scrollRowToVisible with animation

落花浮王杯 提交于 2019-11-28 06:06:09
I am trying to implement an action to scroll to the top of a NSTableView, and the bottom of the NSTableView. I am using scrollRowToVisible but I'd love the action to be animated. Is there a way to do this? While the NSTableView does not have a scroll property you can directly animate, you can instead, with a bit of math animate the scrolling of the NSClipView that the NSTableView lives in. Here is how I did this (within a custom subclass of NSTableView) to smoothly animate the row at rowIndex to be scrolled to the center of the view, if possible: NSRect rowRect = [self rectOfRow:rowIndex];

NSTableView: detecting a mouse click together with the row and column

心已入冬 提交于 2019-11-28 04:44:26
I'm trying to detect when a mouse click occurs in an NSTableView, and when it does, to determine the row and column of the cell that was clicked. So far I've tried to use NSTableViewSelectionDidChangeNotification, but there are two problems: It only triggers when the selection changes, whereas I want every mouse click, even if it is on the currently selected row. The clickedRow and clickedColumn properties of NSTableView are both -1 when my delegate is called. Is there a better (and correct) way of doing this? Peter Lapisu To catch the user clicking a row (only, when the user clicks a row, not

Print the NSTableView's row number of the row clicked by the user

你。 提交于 2019-11-28 03:02:42
问题 I have a NSTableView with one column. I would like to print the row number of the row that the user has clicked on. I am not sure where I should start with this. Is there a method for this? 回答1: You can use the selectedRowIndexes property from the tableView in the tableViewSelectionDidChange method in your NSTableView delegate. In this example, the tableView allows multiple selection. Swift 3 func tableViewSelectionDidChange(_ notification: Notification) { if let myTable = notification.object

Handling custom selection style in view based NSTableView

六眼飞鱼酱① 提交于 2019-11-28 01:21:24
问题 How do I go about drawing my own custom selection style for a view based NSTableView ? I tried putting a BOOL var in my NSTableCellView subclass and set that to YES if it is clicked and then I can successfully draw my custom selection. But how do I change that BOOL var to NO when another view is clicked? Thanks for any help. EDIT: After reading through the NSTableView docs, it looks like I need to subclass NSTableRowView to override the selection drawing, but what do I do with my

Get all Users on OS X

亡梦爱人 提交于 2019-11-27 23:23:14
So I want to implement Parental Controls per user in my app, but I need a way of getting all Users and add them to an NSTableView. These users should be the same displayed by the Login Window, excluding the Other... one and system users. Any ideas on how to do this? Also, I want to be able to get the selection on that table view and of course change the settings displayed according to that. Here's how I do it: #import <CoreServices/CoreServices.h> #import <Collaboration/Collaboration.h> CSIdentityAuthorityRef defaultAuthority = CSGetLocalIdentityAuthority(); CSIdentityClass identityClass =