I have an NSTableView implemented and want to add something where when the user hovers the mouse over a column, i display some custom info. about the info. in that column.
I am not sure if this is a tool tip or if there is an NSTableView delegate to do this.
ANy suggestions ? Thanks.
Yes, it's a tooltip.
Why are you unsure if there is an NSTableView delegate? Have you even glanced at the table view documentation? Doing so would have answered your question faster than asking here.
You want the tableView:toolTipForCell:rect:tableColumn:row:mouseLocation: delegate method.
Related
I have an NSSplitView in My window. the left is an NSOutlineView. When I click the OutlineView's item, the right Which is a custom ViewController's view will look like the below:
Screenshot:
then,a problem occurs that the two NSTextView can't editable while editing the textview. however,I have make it possible to edit it.
Screenshot:
Am I missing anything?
Any hint in the right direction is highly appreciated.
Thanks
This is my demo code:github.com/ljz2012008/TestN.git
How is it possible to detect in NSCollectionView when the last item is visible on scrolling ?
I was looking for a similar solution as this but NSCollectionView doesnt have a similar layout methods.
Any hints ?
It is possible to get noted when the scroll view has scrolled by registering for boundsDidChange notification of the document view as described here Callbacks When an NSScrollView is Scrolled? .
That way one can check which part of the content of the collection view is displayed.
I want to make the NSTableView call height for row before it calls view for column on scroll. (Similar to what UITableView does). Is this possible ?
I really wonder why do you need it,because there can be an alternative for this.
You can first look at
Callbacks When an NSScrollView is Scrolled?,
and then actually call noteHeightOfRowsWithIndexesChanged: which internally calls height for row.
I am just trying to help,but i highly suggest please don re invent the wheel.
Any idea which Cocoa control to use to display the drill-down table as in attached screenshot? On the left panel is a list of items. When an item is selected, the detail of the item is displayed on the right panel. Is it NSOutlineView or NSBrowser? Thanks!
Screenshot http://s1.proxy03.twitpic.com/photos/large/409079140.png
Link to twitpic page
It's an NSTableView on the left, and most likely an NSTextView on the right. The NSTableView on the left most likely has an NSDateFormatter set for the cell in the third column, which handles converting an NSDate object into the NSString value that's shown.
See Table View Programming Guide for more general info on NSTableViews. There is also NSOutlineView, which is a subclass of NSTableView, for when you need to display a data tree. Implementing a table view is much easier than an outline view or NSBrowser, so only go with an outline view if you really need to.
NSOutlineView will produce something like the left panel, but is probably overkill judging by your screenshot.
NSBrowser would give you a Finder-style drill down.
I would personally use two views - an NSTableView on the left and an NSTextView on the right.
I am learning Cocoa and trying to create an application for Mac that displays a simple book list. Each book is an NSView with its cover image, title and author. I want to present this list as a NSTableView with a single column and a book view in each cell. However i can't yet figure out how to display a custom view inside a table cell in interface builder or programmatically. Any tips would be very appreciated :)
Inso.
If all of your "book views" are the same size, why not use NSCollectionView / NSCollectionViewItem? It's a much cleaner solution (provided they're all sized the same).
Assuming a collection view wouldn't be a better solution, what you need to do is to write a custom cell. The column owns exactly one such cell, which the table view will use to draw the column's value for each row.
(If you came from the iPhone, yes, this is completely different from UITableView. Each NSTableColumn has exactly one cell, which it uses for every row.)
If you're using your NSView class somewhere else, then you could make it into a subclass of NSControl and have it use another instance of the same cell class. Like most controls, all the real work would be done by the cell, which enables you to reuse that behavior in multiple controls (your single control and your table view).
See Control and Cell Programming Topics for more info.
Apple added view-based table views in Lion, so you should be able do this natively with NSTableView, now.
(You still can't put an NSView in an NSCell—that wouldn't make sense. But you can have views instead of cells in a table view.)