• 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
Subclassing NSButton, and IB palettes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Subclassing NSButton, and IB palettes


  • Subject: Subclassing NSButton, and IB palettes
  • From: email@hidden (Simon Fraser)
  • Date: Wed, 10 Jul 2002 13:36:13 -0700

I would like to subclass NSButton, to be able to attach some
data to each button in my prefs dialog that indicates which
pref the button acts upon. This should save lots of cookie-
cutter code in the controller. I'd also like to be able to
set up that additional data (a couple of strings on each
control) in Interface Builder.

However, it seems IB doesn't make it easy to create UI for
appending data to existing classes; I can make an IB palette
for MyPrefsButton, but, even through it inherits from NSButton,
IB just shows my panel, and doesn't seem to have a way to
show the existing NSButton panel. Do I really have to implement
panel UI to set all of the properties of the superclass?

As an alternative, it would be acceptible to set the
extra data on my NSButtons in code. Short of subclassing,
is there a way to 'attach' arbitrary data to an NControl,
or any superclass? Categories are out, of course, because
they don't add data, only methods.

I've thought of using tags as a lookup into a table of
data, but that is less maintainable.

Any pointers?
Simon
_______________________________________________
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.

  • Follow-Ups:
    • Re: Subclassing NSButton, and IB palettes
      • From: James DiPalma <email@hidden>
  • Prev by Date: Re: NSTextView - changing font size
  • Next by Date: FSSpec from NSSavePanel
  • Previous by thread: NSTextStorage refreshing NSTextView
  • Next by thread: Re: Subclassing NSButton, and IB palettes
  • Index(es):
    • Date
    • Thread