Questions tagged [nstableview]

1

votes
1

answer
608

Views

NSTableView Bindings doesn't work mac OS Swift

I'm trying to use cocoa bindings with nstableview and I have some problems with bind of parameter value of textfield: I'm using this code, class: class Person : NSObject { var givenName:String var familyName:String var age = 0 var lol = 0 override init() { givenName = 'given' familyName = 'family'...
Igor Voitenko
1

votes
0

answer
9

Views

Animate self-sizing NSTableView row height

I have a project that uses self-sizing table view cells. I'd like to animate when the height of a cell changes. NSTableView's noteHeightOfRows(withIndexesChanged:) will do this for view-based cells, but only when providing the height explicitly in the delegate's tableView(_, heightOfRow:) method. Wh...
smr
1

votes
1

answer
89

Views

How to measure multiline text height in OS X 10.11?

Problem: I want to set long text in view-based NSTableView cell where the row height is to be adjusted appropriately. For this I need to calculate the height of the text bounding rectangle. I found solution: https://discussions.apple.com/thread/4216370?tstart=0 but it uses functions deprecated in 1...
Boris
1

votes
1

answer
87

Views

Binding Swift properties to NSTableView?

I think I have programmed myself into a corner, but I'm hoping you all know a way out. I have a class... class Card { var order: Int? = -1 var tag: String = '0' var comment: String? var data : [String: NSNumber] } Ideally everything would be in data, which is a few strings and lots of numbers. I sta...
Maury Markowitz
1

votes
1

answer
129

Views

Implementing copy method - copy whole row

I am trying to copy the row of the NSTableView on clipboard. Here is my code: - (void) copy:(id)sender { NSPasteboard *pasteboard = [NSPasteboard generalPasteboard]; // I get warning in the line bellow, unused variable changeCount NSInteger changeCount = [pasteboard clearContents]; NSInteger row = [...
user2417624
1

votes
1

answer
84

Views

How to get Insertions and Deletions for NSTableView row animations

I'm looking for an API call that provides the NSMutableIndexSet of rows to remove and insert for animating rows in an NSTableView. Ideally, I should pass an old and new array, to get the resulting remove and insert indices, and I don't see anything like that in NSTableView or related protocols. I'd...
Sheamus
1

votes
1

answer
309

Views

NSTableView in NSScrollView doesn't autoscroll when dragging

I'm currently implementing drag and drop rearranging in a table view in my OS X app. While normal scrolling works fine, autoscroll while dragging it totally broken. If I grab a cell and start dragging, autoscroll just tells the table to scroll to the top. If I manually scroll using the trackpad dur...
Ben Baron
1

votes
3

answer
2.3k

Views

What is the right syntax for tableView functions in Swift 3? xCode 8 issues

I have just upgraded to xCode Version 8.0 (8A218a). I have been trying to convert some older code to Swift 3.0 and I am struggling to understand how to fix some issues with a tableView and I am confused by the documentation and some errors I am getting. I am getting this error *** Illegal NSTableVie...
Peter Wiley
1

votes
1

answer
467

Views

Illegal NSTableView data source

Currently doing some swift development and am playing with this tutorial: https://www.brandpending.com/2016/01/14/using-core-data-in-a-swift-cocoa-app-to-populate-an-nstableview/ I have updated the code as some of the above code is out of date, however i am getting the dreaded *** Illegal NSTableVi...
user3801447
1

votes
1

answer
352

Views

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

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 obviou...
Bogdan Farca
1

votes
1

answer
313

Views

NSTableView with two custom table cell views alternating per row (MacOS)

I have a single column, view-based NSTableView in which I want to place two different custom cell views, one alternating with the other in each row, like so: Odd rows: OddRowNumberCellView. Even rows: EvenRowNumberCellView. There a solution for iOS from Natasha in her highly rated answer UITableview...
Gordon Salter
1

votes
1

answer
77

Views

Why is doubleAction working only when it's handled in a view controller class?

I have a view controller MyViewController: class MyViewController: NSViewController { private let componentList = ComponentList() override func loadView() { componentList.createView(view) componentList.myTableView.doubleAction = #selector(doubleClickOnRow) } @objc func doubleClickOnRow() { print('so...
Joe Huang
1

votes
1

answer
131

Views

How to implement a swipeable NSTableView cell?

A simple example for NSTableViewRowAction? Scroll left/right to delete or other action. - (NSArray *)tableView:(NSTableView *)tableView rowActionsForRow:(NSInteger)row edge:(NSTableRowActionEdge)edge
Joannes
1

votes
1

answer
390

Views

NSTableView get indexPath having the cell

With UITableView it's pretty easy to find the indexPath based on a cell using tableView.indexPath(for: cell) but on MacOS this method does not exist unfortunately. My use case is the following: I have a button in the Cell View and upon click I call the delegated ViewController to do stuff. Now I h...
r4id4
1

votes
3

answer
215

Views

How to change NSTableView header background color in MAC OS X app?

I've tried all found suggested solutions but ended up with this as the closest: The target is to have custom color for: complete header background (e.g. green) text (e.g. white) sort control color (e.g. white) Currently I can only set the interior bg and text color properly while leaving the header...
PerfectGamesOnline.com
1

votes
1

answer
56

Views

How to show scroller indicator in NSTableview when scrolling , hide when not scrolling

I am new in MacOS ,I want to show scroller indicator in NSTableview when scrolling , hide when not scrolling. I am thinking to get the delegate of NSScroller , So i can detect when it scrolls,then hide/show it . Please help
JoeJoe
1

votes
1

answer
1.4k

Views

How do I tell NSTableView not to resize all other columns when showing/hiding a column?

I have an NSTableView, and I have the ability for the user to show or hide columns dynamically (with a mail-style header context menu). My issue is that if the table view is currently wider than it's scroll view (i.e. it's displaying a horizontal scroll bar) when a column is hidden or shown it resiz...
1

votes
1

answer
628

Views

NSTableView and NSSearchField in an NSView, which is the outlet of an NSMenuItem, don't work

I'm having an NSView, which is set as the view: outlet of an NSMenuItem. The view contains an NSTableView (inside an NSScrollView) and an NSSearchField. The NSMenu is shown when the user clicks a specific NSStatusItem. When I launch the application from Xcode (Build and Run), the controls behave wel...
1

votes
1

answer
553

Views

NSOutlineView: Hot To Avoid Yellow Border When Dragging Items?

When I drag rows from an NSTableView to another NSOutlineView, the NSOutlineView gets a yellow highlighting border. How do I avoid that? To be precise, this happens only if I drag the rows from the table into the free space (i.e. not on any items) of the NSTableView. However, when I drag the rows di...
Core
1

votes
1

answer
1.4k

Views

conflicting types for '-(id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row'

I have this code: - (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row { if ([[tableColumn identifier] isEqualToString:@'friend name']) { if (row == 0) { return @'All friends'; } else { return [[friendsArray objectAtIndex:row - 1] name]; } } re...
1

votes
1

answer
638

Views

How can I use custom sorting on an NSTableView bound to an NSArrayController?

I have an NSTableView connected to an NSArrayController by setting the column values in interface builder to the appropriate keys in the NSArrayController. I'd like to use a custom sorting order, specifically, compare:options: with NSNumericSearch. Where can I either change my code to do this, or...
Jason
1

votes
2

answer
1.3k

Views

Updating a NSTableView data source from a background thread

What is the best way to synchronize a data source which is updated frequently from a background thread with the GUI main thread? Should i put a pthread mutex around each method call? This seems to be pretty heavy too me. EDIT: I'm looking for a 10.5 solution
Lothar
1

votes
2

answer
1.4k

Views

Force redraw as resizing NSTableColumn in NSTableView?

I've implemented - (CGFloat)tableView:(NSTableView *)tableView heightOfRow:(NSInteger)row in my NSTableView's delegate to resize the height of my table's rows as the width of the leftmost column changes. The problem is that only that column redraws during the resizing (and any column that slide into...
Dov
1

votes
1

answer
857

Views

NSTableView not displaying items

I'm having a problem getting my table views to display the data from the datasource. Hope someone can point me in the right direction here. In IB I have two table views, I set their tags to 1 and 2 respectively. I also have a AppController object and have connected the two tables to that for dataso...
PruitIgoe
1

votes
1

answer
408

Views

Putting a gradient in all but the selected row of NSTableView

I am trying to highlight a row in an NSTableView using a CALayer. I would like the surrounding rows to fade to a darker color when a specific row is clicked, so that the selected row is clearly in focus and highlighted. I am not sure how to best achieve this, but my initial thought was first to inc...
1

votes
1

answer
1.1k

Views

Programmatically-created NSTableView does not display

I want to create a tableview in code, not IB, but it will not display. Here is my code: - (void)createTableView{ _tableView = [[NSTableView alloc]initWithFrame:NSMakeRect(0, 0, 700, 300)]; [_tableView setBackgroundColor:[NSColor cyanColor]]; [_tableView setDelegate:self]; [_tableView setDataSource:s...
user718408
1

votes
3

answer
1.7k

Views

NSImageCell: Set ToolTip

I'm trying to show a tooltip on the mouse hover at a NSImageCell. I've tried setting the property on Interface Builder (both on the NSImageCell and the NSTableColumn that contains it) but it didn't work. Any ideas?
mikywan
1

votes
1

answer
1.2k

Views

How to set relationships using NSComboBoxCell, NSTableView, and Core Data

I have an example application I'm working on to help me learn about Core Data. In this application I created a model consisting of the entities 'Friend' and 'City'. The application list my friends and which city they are from in an NSTableView. In this table view I would like to have the City col...
Jason
1

votes
2

answer
1.4k

Views

Target Action data source update for view based NSTableView

I have situation where I use view based Table Views and don't want to use bindings between data source and table view. This is mainly due to the fact that my NSTableCellView can have multiple subviews, complex validation and triggered calls to methods in other objects. We have very clear path of upd...
mbpro
1

votes
1

answer
2.2k

Views

Custom Cells in an NSTableView

What's the best way to populate an NSTableView with custom cells? I always utilize Cocoa Bindings when I'm populating standard data, and I always utilize datasources when populated tables with custom cells. What I'm wondering is if there's a way of mixing the two concepts for an optimal design. U...
Anonymous
1

votes
1

answer
382

Views

NSTableView overlay

Id like to add an overlay to an NSTableView when it is loading some data. I found this post which mentions using CALayer with a CIGaussianBlur but I cannot get anything to work. Does anyone know of any good tutorials for displaying an overlay on an NSTableView? (Or even just an NSView).
Kyle
1

votes
1

answer
507

Views

NSTableView weird issue

I have implemented viewbased NSTableView. When i scroll downwards, lines are drawn at the bottom of the NSTableView. Even the text of the buttons which are not the part of NSTableView get darker. I removed the NSTableView Datasource method and buttons' texts are fine, but still lines are drawn at th...
Harsh
1

votes
2

answer
1.7k

Views

How to do collapse and expand view in mac application?

I am new to mac application development, here i want to do expand and collapse view in my custom view(NSView) here the sample image How can i achieve these kind of collapse and expand cell in NSViewController not in NSWindow... Is it possible using NSTableView? I know its a simple question but i fac...
iosLearner
0

votes
0

answer
7

Views

Access value of NSTableView

I need to access to values of my cell based TableView from another controller. I do this code in my main controller and the tableView is in a child controller. Here is what I do but I'm getting nil ... // First grab the tableView controller let myTableViewController = self.children[0] as! MyTableVie...
user3722523
1

votes
1

answer
1.1k

Views

OSX Swift add image into nstableview

I have added a tableview and as well configured the cell with an identifier. Everything works fine, the text of the cell gets displayed. I have just one problem and don't know how to solve it. How can I change the image of the tableview cell? Here is my code: func tableView(tableView: NSTableView, v...
Tom el Safadi
1

votes
1

answer
422

Views

How to make some specific items of a NSTableView in bold?

I would like to set some items of a non-editable, View Based NSTableView in bold. The items correspond to a specific index number of the array I use to populate the TableView. I would like to set the change before the NSTableView is displayed to the users. I tried to handle this change in this metho...
Cue
1

votes
1

answer
758

Views

NSTableView reload data from different controller

I am having problems updating the content of two tables, which are placed in two different tabs of a NSTabView and each controlled by a different controller (Controller1 and Controller3), from a third controller (Controller2). I tried three different approaches: Approach #1: I created in Controller1...
whiplash
1

votes
1

answer
344

Views

set NSButton position inside NSTableView to center programmatically

Is it possible to set the 'position' value (see image below) programmatically instead of using IB? I would need to set it like the one in the image. I've been searching for a solution for a while now without luck.
sharkyenergy
1

votes
2

answer
725

Views

How to convert Cell-based table into View-based table in cocoa?

I'm having hard time understanding how to implement view-based table in cocoa. Right now I have working implementation of old-fashioned cell-based table. As I figured out, just dragging the NSTableCellView onto my columns in a NIB file won't make my table view-based :) I read through this article:...
Eugene Gordin
1

votes
1

answer
1.6k

Views

How to set a background color for NSTableCellView?

I've made an NSTableCellView in my nib, which has the textField occupying the entire space, and it works great for displaying text, and tracking the size of the column. Now I want to be able to set a solid background color for it, in a specific case (i.e., not for all cells). How do I do this? I th...
user3404855

View additional questions