nstableview

Can't CTRL+Drag NSButton to custom NSView header

[亡魂溺海] 提交于 2019-12-02 06:21:05
问题 I'd like to create a custom NSTableCellView instantiated by Interface Builder. I've set my Table Cell View class to MyTableCellView , and properly created MyTableCellView : NSTableCellView .m/.h files. However, I just can't CTRL+Drag a simple button from inside this view to MyTableCellView.h in order to create an IBOutlet . Here is a video to show what happens: http://youtu.be/sNNbuVT-SZs. How the view is subclassed: How I try to CTRL+Drag a button Also, sometimes, Interface Builder just don

Preventing contextual menu showing on specific cell in a view based NSTableView

一笑奈何 提交于 2019-12-02 04:25:44
Is there any way of preventing a contextual menu (and the associated selection "ring" around the cell view) being shown when right-clicking on a specific cell in a view-based NSTableView ? I'm not talking about disabling the right-click action on ALL the cells, but only on specific ones. I've obviously tried all the delegate methods dealing with selection changes but none works because the selectedRow property is not changing, only the clickedRow does. So basically I'm looking for something equivalent to func tableView(_ tableView: NSTableView, shouldSelectRow row: Int) -> Bool but for the

NSTableView with dynamic height

╄→尐↘猪︶ㄣ 提交于 2019-12-02 02:26:33
I am working on Xcode 6.1.1 on OSX 10.10.2 How do I make my table adjust its height, so that the height of table would always be equal to the sum of heights of all the rows. In other words, it should not display any empty rows. And adding and deleting the rows would require NSTableView to resize it self. Initially I was thinking of using following selection after addition and deletion of row. [_tableViewHandle setFrameSize:(NSMakeSize(oldwidth, sumOfHeightOfAllRows)))] But it looks like a hack. Also can it be done using IB only ? Don't know if it may be done using IB only. In my case I use

Can't CTRL+Drag NSButton to custom NSView header

心已入冬 提交于 2019-12-02 00:48:31
I'd like to create a custom NSTableCellView instantiated by Interface Builder. I've set my Table Cell View class to MyTableCellView , and properly created MyTableCellView : NSTableCellView .m/.h files. However, I just can't CTRL+Drag a simple button from inside this view to MyTableCellView.h in order to create an IBOutlet . Here is a video to show what happens: http://youtu.be/sNNbuVT-SZs . How the view is subclassed: How I try to CTRL+Drag a button Also, sometimes, Interface Builder just don't allow the cell view's class to be modified. What's happening ? I finally found a solution, that is a

Table view not updating according to bindings

泪湿孤枕 提交于 2019-12-01 14:05:05
This is a very newbie question, and this is something I have done many times before, but there's something I'm missing this time. In my AppDelegate.h file I declare an NSArray and set it as a property: @interface AppDelegate : NSObject { NSArray *lines; } @property(readwrite, retain) NSArray *lines; @end And then in the AppDelegate.m file in the awakeFromNib method I alloc it: lines = [[NSArray alloc] init]; Then I have a method that sets the lines array: NSString *fileContents = [NSString stringWithContentsOfFile:[NSHomeDirectory() stringByAppendingPathComponent:@"Desktop/sometextfile.txt"]

Table view not updating according to bindings

雨燕双飞 提交于 2019-12-01 12:26:40
问题 This is a very newbie question, and this is something I have done many times before, but there's something I'm missing this time. In my AppDelegate.h file I declare an NSArray and set it as a property: @interface AppDelegate : NSObject { NSArray *lines; } @property(readwrite, retain) NSArray *lines; @end And then in the AppDelegate.m file in the awakeFromNib method I alloc it: lines = [[NSArray alloc] init]; Then I have a method that sets the lines array: NSString *fileContents = [NSString

Rounded corners on NSTableView

♀尐吖头ヾ 提交于 2019-12-01 12:07:28
I have a custom view subclass similar to NSBox that draws a rounded box background. The problem is that if I place a view like an NSTableView in the box view, it does not clip to the rounded corners. Is there any way to round the corners of NSTableView and its parent scroll view? I haven't tried this with a table view but have with other controls. In a subclass of NSTableView (or whatever view/control you want to clip) Override drawRect: Create an NSBezierPath with the shape you want (probably appendBezierPathWithRoundedRect:xRadius:yRadius: just remember to use the view's bounds as the size)

How to know we reached the last row of NSTableView

冷暖自知 提交于 2019-12-01 08:33:30
NSTableView is what I am using to display millions of data, which I can not get in response due to time out. So what I decided to get response in pages say 1-100 then 101-200 etc. So my problem starts here, how can I know that I have reached to the end of tableView or the cell is visible say 100th row? I dont want to implement Load More.. kind of button etc. After this I will send a new response with new range. Here is what I have tried so far: Tried to track the scrollView and get next set of data by a service call. * It works with old mouse but it failed with swipe. Maybe you can determine

Disable NSVisualEffectView in Source List NSTableView

一笑奈何 提交于 2019-12-01 05:01:31
问题 I have an older application that has a specific appearance based on NSCell-based NSTableView having Source List highlighting. Unfortunately, on Yosemite this adds the NSVisualEffectView vibrancy under the selected cell which breaks the appearance in an unpleasant way. I can't find a way to opt-out of this behaviour, unfortunately. Setting Regular highlighting breaks the appearance in another way (grey selection instead of blue). Any idea if there is a way to opt-out of this behaviour on 10.10

How to update row heights of NSTableView with usesAutomaticRowHeights = true after column resize?

房东的猫 提交于 2019-12-01 01:30:19
Since macOS 10.13 we can use NSTableView with automatic row heights, thanks to the new property usesAutomaticRowHeights and of course auto layout. This works quite nicely. But when the user resizes a column, the calculated heights are no longer correct, and gaps appear in the tableview cells. Is there a proven way to update the row heights after column resize in this scenario? I already tried methods like updateConstraintsForSubtreeIfNeeded() , updateConstraints() , setNeedsDisplay() , reloadData() and so on, but nothing works. Something that worked for me was to include the