Re: An other silly PrefPane problem
Re: An other silly PrefPane problem
- Subject: Re: An other silly PrefPane problem
- From: Steve Bennett <email@hidden>
- Date: Thu, 21 Mar 2002 13:55:05 -0500
Manuel Darveau <email@hidden> wrote:
>
Sorry to bother everyone with my preference pane problems but the doc is a
>
bit incomplete...
>
>
I want to save some info when the user unselect the preference pane. My
>
first ides was to put the saving code in -willUnselect.
>
>
The problem is that the state of my checkbox are always set to OFF during
>
this event. Even if they are really checked in the pane. I tried to place a
>
debug button in the pane to see if the state is correct outside of the
>
willUnselect method and the state is correct!
>
>
I have also tried with -shouldUnselect and the same thing happen.
>
>
Any idea?
Following along the lines of Preference Pane view contents being invalid
inbetween selection and unselection, I'm guessing that the control has gone
away by the time you try to use it.
I'd say your best bet would be to have the checkbox targets assigned to
methods in your object, which will then store the current state in your
object. This better matches the Model-View-Controller (MVC) architecture
that Preference Panes are supposed to use, anyway.
Basics of MVC architecture - you have a View (your controls), a Controller
(your preference pane object), and a Model (your data). When you start up
(didSelect) the Controller reads the data from the Model (which in turn may
need to initialize from a Preference file...), and updates the controls in
the View to reflect that data. While running, the View sends messages to
the Controller, which updates the data in the Model, which can either be
stored in the preference file right away (which most preference panes do),
or be saved to be stored later when the Preference Pane is unselected.
The View never actually stores any data except for display. So you never do
anything like query the state of a control or the like.
>
Am I the only one that find the documentation quite minimalist?
Actually, the Preference Pane docs are, by Cocoa documentation standards,
quite extensive. Unfortunately, they *are* rather lacking in a lot of
detail, which doesn't say much about Cocoa documentation as a whole. <grin>
I would give a whole lot for Cocoa documentation which was at least a
quarter as comprehensive as the old Inside Mac books -- but they've got a
*long* way to go to reach that level.
-->Steve Bennett
_______________________________________________
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.