• 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: Multiple Toolbars, Same Window like XCode
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multiple Toolbars, Same Window like XCode


  • Subject: Re: Multiple Toolbars, Same Window like XCode
  • From: "I. Savant" <email@hidden>
  • Date: Wed, 1 Mar 2006 10:40:35 -0500

Keith:

Thanks, I did try that. With that approach, the results are somewhat different. I don't get the run-time error but the resizing issue remains the same. Most frustrating!

--
I.S.


On Mar 1, 2006, at 10:31 AM, Keith Blount wrote:

Not sure if this would work, but...

Instead of having separate toolbars that you swap
around, have you tried setting up your delegate
methods so that they return different toolbar item
identifiers depending on the mode? Something like:

- (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar
*)toolbar
{
	if ( mode == firstModeTag)
	{
		return [NSArray
arrayWithObjects:someIdentifiersHere,nil];
	}
	else if (mode == secondModeTag)
	{
		return [NSArray
arrayWithObjects:someOtherIdentifiersHere,nil];
	}
	// etc
}

// And the same for -toolbarDefaultItemIdentifiers:

I've never tried this out myself and it may completely
fail, but it might be worth a shot...

All the best,
Keith

--- ORIGINAL MESSAGE ---

[ 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 You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

_______________________________________________ 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
References: 
 >RE: Multiple Toolbars, Same Window like XCode (From: Keith Blount <email@hidden>)

  • Prev by Date: NSDocument saveDocumentAs with suggested name
  • Next by Date: Re: Need Help Please....Truncation Mode for Window Title
  • Previous by thread: RE: Multiple Toolbars, Same Window like XCode
  • Next by thread: Core Data threading again
  • Index(es):
    • Date
    • Thread