With xCode 9, in a NSTableView, when I use objectValueForTableColumn I must have columns with a NSTableColumn to see my data. On the other hand, when I use viewForTableColumn I can have the button from IB NSTextFielCell. I do not understand why these two method does not work in the same way ?In the same order of idea, I can programm the return key with NSTextFielCell but not with NSTableColumn.In the end, in my program, I add columns according to the number of fields which I want to handle. That works with NSTableColumn but I cannot use the return key. And with NSTextFielCell I can use the return key but I cannot show my data in the added columns. The function NSTableCellView *cellView = [tableView makeViewWithIdentifier:tableColumn.identifier owner:self]; gives me an nil cell.I think that I make something bad but what ?Somebody would have an idea ?
Search results for
column
2,050 results found
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
— All NSTableViews use NSTableColumn for their columns.— There are two ways of showing content in a table column:The old way uses subclasses of NSCell (like NSTextFieldCell), called a NSCell-based table view. The new way uses NSTableCellView, called a view-based table view. You should always use a view-based table view, and never the old way. (The old way is supported so that existing code doesn't stop working.)— In a view-based table view, you can still use objectValueForTableColumn, but you don't have to. Your table cells (NSTableCellView) has an objectValue property, that must be made to refer to an object that supplies data to the controls inside the table cell (buttons, text fields, etc). There are three ways of doing that:1. In your viewForTableColumn method, after you create the cell, you can simply set the property: NSTableCellView *cellView = [tableView makeViewWithIdentifier:tableColumn.identifier owner:self]; cellView.objectValue = …2. In your data source, you can implement objectValueForT
Topic:
UI Frameworks
SubTopic:
AppKit
Tags:
Thank you very much for your reply.I can supply you more explanation.In my NSTableView I want to show the components of the path of a file (5 or 6 components (fields)).In IB I create two columns. I create the others by program:nbcMax = 6;for (NSInteger col = [[tableView tableColumns] count]; col < nbcMax; col++){ NSTableColumn *tc = [[NSTableColumn alloc] initWithIdentifier:[NSString stringWithFormat:@tc%ld, col]]; [[tc headerCell] setStringValue:[NSString stringWithFormat:@%ld, col]]; [tableView addTableColumn:tc];}With viewForTableColumn only the first two columns, created with IB, are filled. The others exist but are empty :- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row{ NSTableCellView *cellView = [tableView makeViewWithIdentifier:tableColumn.identifier owner:self]; NSArray *array = list[row]; NSInteger col = [[tableView tableColumns] indexOfObject:tableColumn]; if (col < [array count]) { NSString *str = [array obje
Topic:
UI Frameworks
SubTopic:
AppKit
Tags:
You can't do that. A table view is completely view-based or completely NSCell-based, and cannot be a mixture of the two. If you implement the tableView:viewForTableColumn:row: delegate method, the table view is view-based.>> If I create all columns (6) in IB, it works very well but I do not know the number of columns which I shall need.Create a table with 6 columns, then programmatically remove the columns you don't need. This is much easier than creating a table with 2 columns and adding more.
Topic:
UI Frameworks
SubTopic:
AppKit
Tags:
Hi Mike,It's being set with:storedPMatrix = matrix_float4x4(projectionFov: radians(fromDegrees: 65), aspect: viewWidth/viewHieght, nearZ: 0.1, farZ: 100)and this is declared in a library I got from the RW tutorials site:init(projectionFov fov: Float, aspect: Float, nearZ: Float, farZ: Float) { let y = 1 / tan(fov * 0.5) let x = y / aspect let z = farZ / (nearZ - farZ) columns = ( float4( x, 0, 0, 0), float4( 0, y, 0, 0), float4( 0, 0, z, -1), float4( 0, 0, z * nearZ, 0) ) }
Topic:
Graphics & Games
SubTopic:
General
Tags:
I'm building a Swift app, and can successfully populate the rows of an NSTableView using Cocoa bindings in a Storyboard. When I hook up a NSTableColumn's Sort Key & Selector, the click-on-column-heading becomes active (the sort-direction icons appear as expected), but the rows are not re-sorted. I've thrashed around a bit, replacing my Swift Array with an NSMutableArray, trying variations on Sort Key, but no joy... Anyone have any clues?
Table view don't sort themselves. They just store per-column sort descriptors which (as you saw) affect the presentation of the UI. Instead, changing the sort descriptors sends a delegate method tableView(_:sortDescriptorsDidChange:) (https://developer.apple.com/documentation/appkit/nstableviewdatasource/1532935-tableview), and, as the discussion on that page says, it's up to the data source to sort the data model appropriately.However, no one actually does it that way. Instead, the usual solution is to put a NSArrayController between the table view and its data source (the content of the array controller). In that case, the table view sort descriptors are automatically bound to the array controller's sort descriptors, and the array controller keeps an internal array of sorted object proxies (arrangedObjects) that it feeds back to the table view column. In this scenario, you get the sorting for free.(Since this is done with bindings, you can change the sort descriptors on the table view, and
Topic:
Developer Tools & Services
SubTopic:
General
Tags:
QuinceyMorris -- what you're describing is exactly what I want to happen. Years ago I did this stuff in ObjectiveC (there used to be a detailed example in the Apple docs, but it disappeared over the years), and I'm just trying to get back to the same level of proficiency in Swift. When I could get KVO to work, I found it marvelous, but Swift, with its type-safe behaviours has thrown me a real curve ball.I haven't been exploring delegate method tableView(_:sortDescriptorsDidChange:) because I'm using bindings to populate the rows, and I wouldn't expect to set a table view delegate under those circumstances. Or do bindings just replace the dataSource and I can fiddle with the delegate protocol methods?I am already using an NSArrayController to provide the data via bindings.In detail, the NSTableView instance has the content binding to the NSArrayController's arrangedObjects.At each row, for the name column, the NSTextField is bound to the objectValue.name of the containing NSTableCellView. This works O
Topic:
Developer Tools & Services
SubTopic:
General
Tags:
(It's a while since I had to sort a column, so forgive me if I misremember at any point.)>> I'm using bindings to populate the rows, and I wouldn't expect to set a table view delegate under those circumstancesYou almost always end up wanting a delegate for something or other, so it's usual to have one. But you don't need to do anything with tableView(_:sortDescriptorsDidChange:) in your scenario. The array controller will do the heavy lifting for you.>> do bindings just replace the dataSource … ?Yes, they do. If you use bindings, you don't need a data source (and it can be nil). However, for historical reasons, methods that deal with dragging rows are in the data source protocol, not the delegate protocol. If you need to support dragging, you will need to use a data source after all. In this case, you do not implement the data source methods that the documentation says you must implement. You just implement the ones you need to support dragging.>> I am already using an NSArrayContro
Topic:
Developer Tools & Services
SubTopic:
General
Tags:
I found a way to turn on/off the menu. If the column Compare/Blame ... is shown the Syntax Coloring menu does not apear. If the right column is not visible one can edit the Color scheme of the code ....
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags:
I am trying to get my code to use MPSMatrixDecompositionCholesky correctly but it is giving me an incorrect matrix result.Any help would be greatly appreciated!let device = MTLCreateSystemDefaultDevice()!let commandQueue = device.makeCommandQueue()let M = 2let row = M * MemoryLayout<Float>.stridelet matlength = M * rowlet mdesc = MPSMatrixDescriptor( dimensions: M, columns: M, rowBytes: row, dataType: MPSDataType.float32)let arrayA: [Float] = [ 2.0 , 1.0 , 1.0 , 2.0 ]let buffA = device.makeBuffer(bytes: arrayA, length: matlength)let matA = MPSMatrix(buffer: buffA!, descriptor: mdesc)let arrayB: [Float] = [ 1.0 , 0.0 , 0.0 , 0.0 ]let buffB = device.makeBuffer(bytes: arrayB, length: matlength)let matB = MPSMatrix(buffer: buffB!, descriptor: mdesc)let arrayX: [Float] = [ 0.0 , 0.0 , 0.0 , 0.0 ]let buffX = device.makeBuffer(bytes: arrayX, length: matlength)let matX = MPSMatrix(buffer: buffX!, descriptor: mdesc)let arrayL: [Float] = [ 0.0 , 0.0 , 0.0 , 0.0 ]let buffL = device.makeBuffer(bytes: array
I’m not a nettop expert but it’s likely that: rx_ooo means “received out of order”tx_cwin means “transmit congestion window”In situations like this I generally follow the breadcrumb trail from the tool’s source code in Darwin to the fundamental implementation within the kernel. Unfortunately that’s not possible in this case because nettop is not open source. Given that, my recommendation is that you file a bug agains the man page asking for a better explanation of the columns. Please post your bug number, just for the record. Still, getting a better description of the column names won’t necessarily help. To make sense of values like this you really need to understand the ins and outs of TCP. My go-to reference for this sort of thing is TCP/IP Illustrated by Stevens.Share and Enjoy — Quinn “The Eskimo!” Apple Developer Relations, Developer Technical Support, Core OS/Hardware let myEmail = eskimo + 1 + @apple.com
Topic:
App & System Services
SubTopic:
Networking
Tags:
I would check the value of rowBytes(fromColumns:dataType). You're currently assuming it is columns*sizeof(float) but the docs for MPSMatrixDescriptor say: For performance considerations, the optimal row stride may not necessarily be equal to the number of columns in the matrix. The rowBytes(fromColumns:dataType:) method may be used to help you determine this value.If this row stride is different between the different GPUs you've tried, that would explain the error.
Topic:
Graphics & Games
SubTopic:
General
Tags:
I'm really stuck on the following challenge:The printTable(_:) function has a bug – it crashes if any of the data items are longer than the label of their column. Try changing Joe’s age to 1,000 to see this happen. Fix the bug. (For an easier version of this challenge, just make the function not crash. For a harder version, make sure all the rows and columns of the table are still aligned correctly.)The challenge is referring to the following://: Playground - noun: a place where people can play import Cocoa protocol TabularDataSource { var numberOfRows: Int { get } var numberOfColumns: Int { get } func label(forColumn column: Int) -> String func itemFor(row: Int, column: Int) -> String } func printTable(dataSource: TabularDataSource & CustomStringConvertible) { print(Table: (dataSource.description)) var firstRow = | var columnWidths = [Int]() for i in 0 ..< dataSource.numberOfColumns { let columnLabel = dataSource.label(forColumn: i) let columnHeader = (column
I suggest you start by describing what solution you want, that would solve the problem. If a data item is longer than the width of the column, then I want to … do what? … to make sure the alignment stays correct. If you can describe in words what would solve the problem, you're more than half way to the solution.For example, you might say, If a data item is longer than the width of the column, then I want to warp the fabric of space-time to squeeze the data into the space allowed to make sure the alignment stays correct. Then you'd know you had to go into a physics lab and start inventing.OK, so that's not a practical solution, so what is?
Topic:
Programming Languages
SubTopic:
Swift
Tags: