Re: Problem with custom control in NSToolbar
Re: Problem with custom control in NSToolbar
- Subject: Re: Problem with custom control in NSToolbar
- From: Chris Giordano <email@hidden>
- Date: Tue, 8 Jun 2004 11:55:49 -0400
On Jun 8, 2004, at 11:03 AM, Laurent Daudelin wrote:
Chris,
Here is how I do it:
In class UKToolbarFactory (slightly modified to support custom views):
-(NSToolbarItem*)toolbar:(NSToolbar*)toolbar itemForItemIdentifier:
(NSString*)itemIdentifier willBeInsertedIntoToolbar:(BOOL)flag;
{
...
return tbi;
}
Now, in the window's delegate, here is the method that corresponds to
the
item identifier:
- (NSView *)switchWebViewPopup
{
return [self createSwitchWebViewPopup];
}
and here is 'createSwitchWebViewPopup':
- (NSView *)createSwitchWebViewPopup
{
...
return newSwitchWebViewPopUp;
}
So, as you can see, it's creating a new view everytime it is asked for
one.
I haven't tried creating a copy of the current toolbar item if there
is an
existing one, but will do so shortly.
Thanks!
Laurent,
Ok. You win. :) I'm stumped.
It looks like it should be doing the right thing. The only thoughts
that I have are to verify that it's actually entering the code that
creates the new view (both in
toolbar:itemForIdentifier:willBeInsertedIntoToolbar: and in
createSwitchWebViewPopup), and to try just the straight copy of the
toolbar item rather than creating a new one manually. Otherwise, I'm
at a bit of a loss.
If I come across anything else, I'll let you know.
Good luck!
chris
_______________________________________________
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.