Re: How to build a "System Preference" Panel
Re: How to build a "System Preference" Panel
- Subject: Re: How to build a "System Preference" Panel
- From: David P Henderson <email@hidden>
- Date: Sun, 17 Jun 2001 08:56:33 -0400
On Sunday, June 17, 2001, at 05:07 , email@hidden wrote:
I need to build a preference panel for an application which contains
about 20 subcategories. so i thougth a good idea is to implement
something in the look and feel of the system preferences panel as the
user is already familiar with this panel.
i've taken a closer look on the nib's used by apple to implement the
system preferences panel. there is one main nib with the icon view's
and two boxes and there are a number of nib's in the
/System/Library/Preferences folder, which reflect the possible settings.
and here starts my problem: how is it done to load the separate nib's
within (probably a view) of the main-nib and to resize the main-nib to
the proper size. (like the system preferences panel implements it).
has anyone done this before? i think this is a elegant way to handle
application preferences. if anyone can help me build this panel i will
release the source code for it, so anyone who likes to can implement
his application preferences on this basis.
The answers you seek are in the NSView class. Specifically the methods
involving adding and removing views. You want to replace a subview in
your panel with the view contents of the nib for the selected icon. One
trick for doing this easily is to use borderless/titleless NSBoxes
connected to outlets; then, you can just swap out the subviews of the
boxes. Remember to retain the removed view(s) for reuse.
Dave
--
Chaos Assembly Werks
"A lie can run around the world before the truth can get its boots on."
- Israel Zangwill (not Edward R. Murrow)