• 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: How do you get an NSCell subclass into a Palette?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do you get an NSCell subclass into a Palette?


  • Subject: Re: How do you get an NSCell subclass into a Palette?
  • From: Ricky Sharp <email@hidden>
  • Date: Fri, 1 Jun 2007 15:20:23 -0500


On Jun 1, 2007, at 9:47 AM, Jerry Krinock wrote:


On 2007 May, 31, at 13:34, Ricky Sharp wrote:

Look again at /Developer/Examples/InterfaceBuilder/BusyPalette/

Specifically, look in BusyPalette.m for handling of the custom BPCellPboardType pasteboard type.

The item on the palette window that you'll drag will still be a view (cells can only render themselves when inside a view). The custom pasteboard type above is used to establish acceptable drop- targets as well as handling when pastes actually occur (basically grab the cell in the dragged view and assign that cell to the drop- target object)

Thank you, Ricky. That was the hint which I needed. After building BusyPalette and looking at its 'ExpressionFormatter', I see how it works...


In the "Palette View" window, icons representing NSView subclasses are in fact the actual object. That's fine, because IB allows views to be dragged into windows. But what if the object is a subclass or NSCell or some other class which cannot be dragged into a window? Well, they did a little trick. Instead of being the actual object, the icon in this case is a proxy NSImageView, which method -[YourSubclassOfIBPalette finishInstantiate] "associates" with the actual object.

Yes, proxies are what you'll see quite a bit in palettes. My palette's main nib only contains image views which are then proxies to views, cells, formatters, etc. In some cases, some of my proxies allow me to drag in custom NSMatrix subclasses already prefilled with cells.


___________________________________________________________
Ricky A. Sharp         mailto:email@hidden
Instant Interactive(tm)   http://www.instantinteractive.com

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Re: How do you get an NSCell subclass into a Palette? (From: Jerry Krinock <email@hidden>)

  • Prev by Date: Re: open proxy setting
  • Next by Date: About Technical Q&A QA1518 - Using UTIs to Identify Image Files - what about Video?
  • Previous by thread: Re: How do you get an NSCell subclass into a Palette?
  • Next by thread: char Array to NSString to cString?
  • Index(es):
    • Date
    • Thread