Multiple Toolbars, Same Window like XCode
Multiple Toolbars, Same Window like XCode
- Subject: Multiple Toolbars, Same Window like XCode
- From: "I. Savant" <email@hidden>
- Date: Wed, 1 Mar 2006 08:45:06 -0500
[ Sorry - forgot to label the thread with a subject! ]
List:
I'm trying to create a document window with one toolbar for each
of its major modes, like XCode. I've approached the problem by
creating (and retaining) two different toolbar instances. I
implemented the basic delegate methods, providing a different set of
allowed / default item identifiers depending on the toolbar. I swap
the toolbars using [window setToolbar:toolbar]; when the document's
mode changes.
The problem is that, in certain circumstances, the following error
occurs while swapping the toolbar (but not on the setToolbar: line,
this is somewhere in the Cocoa frameworks):
*** NSRunLoop ignoring exception '*** -[NSCFArray? addObject:]:
attempt to insert nil' that raised during posting of delayed perform
with target 550a0f0 and selector '_doDelayedValidateVisibleToolbarItems'
At this point, the toolbar that was switched to is missing items
where it wasn't before. It's important to note (because I think this
may be part of - if not all of - the problem): Both toolbars share
some items - and the shared items are the ones that stay during the
erroneous swap while the non-shared ones are the ones that disappear.
I'm thinking this is some problem with the auto-saving behavior.
Looking in the cocoa-dev list archives, I found a reference to such a
problem with a solution that worked by disabling the auto-save. The
problem is, I want the user to be able to customize each toolbar with
persistence.
When I posted this on cocoadev.com, it was suggested that I create
a dictionary to retain the toolbaritems. I tried that and got the
same error after switching between toolbars several times. I then
told the method above to return [item copy]; (ignoring the memory
leak for now. That error went away, but now any toolbars not
currently displayed when the window is resized produce drawing errors
when you switch back to it after a resize.
Has anyone done this before? What am I missing? Any insight as to
how XCode might be accomplishing this? Are they using private APIs?
Any help is most appreciated. Thanks!
--
I.S.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden