nstableview

Sorting NSTableView

纵然是瞬间 提交于 2019-12-10 03:47:15
问题 I have two coloumn in NSTableView as Name and Salary with 5-10 values. I want to sort these coloumn after click on header of both the column. There is lots of data present in Internet but I am not able to use these. Please help me to do this in cocoa. Thanks in advance and appreciate any help. 回答1: Each table column has a method setSortDescriptorPrototype Sort descriptors are ways of telling the array how to sort itself (ascending, descending, ignoring case etc.) Iterate over each of the

Keyboard focus lost after inserting and editing new object, when NSArrayController „Auto Rearrange Content“ is enabled

有些话、适合烂在心里 提交于 2019-12-09 23:48:13
问题 I have a master-detail kind of application OS X 10.9 only: An NSTableView on the left side of the window, the details as NSTextFields on the right side. I have not set the tab order specifically, out of the box works just fine. Except after inserting a new object: after inserting a new object the object is selected in the NSTableView. hit tab the first NSTextField is selected write something, hit tab now instead of selecting the next NSTextField nothing is selected, hit tab the NSTableView is

How to set background color of cell with NSButtoncell type in NSTableView?

这一生的挚爱 提交于 2019-12-09 23:41:03
问题 This is my table view delegate: - (void)tableView:(NSTableView *)tableView willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)tableColumn row:(int)row { id theRecord; NSMutableString *gid; theRecord = [tableDataSource objectAtIndex:row]; gid = [theRecord objectForKey:@"gid"]; if (([gid intValue] % 2) != 0) { [aCell setDrawsBackground: YES]; [aCell setBackgroundColor: [NSColor colorWithCalibratedRed: 237.0 / 255.0 green: 243.0 / 255.0 blue: 254.0 / 255.0 alpha: 1.0]]; } else { [aCell

How to invert text colour of selected NSTableView row

帅比萌擦擦* 提交于 2019-12-09 17:31:48
问题 I have an NSTableView in which I'm changing the colour of the text in a particular column, but when a row is selected, the text does not change to a more appropriate colour so that it's readable. Finder's Date Modified, Size, and Kind columns have grey text, and when you select a file/folder row, the grey text changes to white (so that it's readable within the blue highlight). I can't find a magic checkbox on XCode to enable this behaviour by default, so does anybody know how I might achieve

Clickable url link in NSTextFieldCell inside NSTableView?

▼魔方 西西 提交于 2019-12-09 13:13:37
问题 I have a NSAttributedString that I'm using in a NSTextFieldCell. It makes several clickable url links and puts a big NSAttributedString inside the NSTextFieldCell. Whenever I am viewing the NSTextFieldCell normally and it's highlighted, I cannot click on the links. If I set the TableView so I can edit each column or row, when I click twice, go into Edit mode and view the NSTextFieldCell contents, my links show up and are clickable. When I click away from the row, I can no longer see clickable

Why are my images in my NSTableView faded out?

喜你入骨 提交于 2019-12-09 10:51:26
问题 To start, there's an NSArrayController ("Servers") whose content is an array of "server" objects. I also have an NSTableView with a column. The column is bound to Server's "arrangedObjects.status" property. I use a custom NSValueConverter to make that status into an image for the column's dataCell which is an NSImageCell . What I don't understand is why the images that show up in the column are correct, but consistently faded out. Just to test, I have the same image outside the table view for

NSTableView hit tab to jump from row to row while editing

好久不见. 提交于 2019-12-09 06:25:29
问题 I've got an NSTableView. While editing, if I hit tab it automatically jumps me to the next column. This is fantastic, but when I'm editing the field in the last column and I hit tab, I'd like focus to jump to the first column of the NEXT row. Any suggestions? Thanks to Michael for the starting code, it was very close to what ended up working! Here is the final code that I used, hope it will be helpful to someone else: - (void) textDidEndEditing: (NSNotification *) notification { NSInteger

How to update NSTableView without using -reloadData?

淺唱寂寞╮ 提交于 2019-12-09 04:39:00
问题 I am new to the Mac. I am trying to update a particular cell in NSTableView without using -reloadData , as -reloadData updates the whole table. I have tried everything but all was in vain. I am trying to do something similar to what we used to do in CListCtrl in MFC or in .NET. 回答1: Have a look at reloadDataForRowIndexes:columnIndexes: method. To update a single cell the following should work: [yourTable reloadDataForRowIndexes:[NSIndexSet indexSetWithIndex:row] columnIndexes:[NSIndexSet

NSTableView get rid blank space separating columns

主宰稳场 提交于 2019-12-08 21:11:04
问题 I have an NSTableView with 4 columns. I also have a custom background color for each row. The only problem is I have these ugly white spaces where the gridlines would go in both the horizontal and vertical axis. I have both unchecked in IB, but they still show up. How can I get rid of the vertical ones and change the color and size of the horizontal ones? Here's what I see: alt text http://img815.imageshack.us/img815/9030/homex.png 回答1: To get rid of vertical spaces but keep the horizontal

How can I set NSTableView column to use monospaced numbers?

◇◆丶佛笑我妖孽 提交于 2019-12-08 18:52:53
问题 El Capitan introduced San Francisco system font, which has proportional digits by default. This makes numbers in table columns look jagged and hard to compare: I'd like to enable fixed-width numbers option for the font, but keep using the default system font and keep backwards compatibility with earlier versions of OS X. In Interface Builder selecting font > Font Panel > Typography > Monospaced Numbers does not affect the font (XIB file remains unchanged). What's the right way to set