• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Problems with custom Cell in NSTableView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems with custom Cell in NSTableView


  • Subject: Re: Problems with custom Cell in NSTableView
  • From: Brian Webster <email@hidden>
  • Date: Mon, 15 Jul 2002 10:20:41 -0500

On Monday, July 15, 2002, at 09:47 AM, cocoa-dev-
email@hidden wrote:

So, I have two questions:

1) Is it acceptable behavior of my drawWithFrameInView() method to do nothing in the case of the Cell being "invisible"? Or would I be more correct to draw, say, a white rectangle in the NSRect I'm provided? My
method is working, but that doesn't mean it's correct of course ;)

I think drawing nothing works best in this situation. That basically means that the table view will be responsible for the background in those cells, including highlighting selected cells in the correct color, etc. I guess in your case, since only unselected cells will be drawn this way, it doesn't really matter, but filling the cell would mean an additional drawing operation.

2) What is the correct way of making the NSPopUpButtonCell display the currently selected item? Or, is there something extra I need to do to make it work in the manner I'm using it?

The trick with using NSPopUpButtonCell is the fact that the object value of such a cell is an NSNumber that contains the index of the item selected in the menu. To make your table view display the correct item, you should return the correct NSNumber from your tableView:objectValueForTableColumn:row: method. When someone selects an item from the pop-up, an NSNumber will be passed into your tableView:setObjectValue... method as well. And, no this isn't documented anywhere, although I filed a bug report on it and the bug reporter claims they've updated the docs for the next revision.

--
Brian Webster
email@hidden
http://homepage.mac.com/bwebster
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: Intercepting Some Keyboard Events for NSTextView
  • Next by Date: Re: NSTableView philosophy question.. (MVC Pattern) where to putthe dataSource delegate?
  • Previous by thread: Problems with custom Cell in NSTableView
  • Next by thread: Piping shell scripts
  • Index(es):
    • Date
    • Thread