Re: Calling IB Actions In PB
Re: Calling IB Actions In PB
- Subject: Re: Calling IB Actions In PB
- From: Albert Atkinson <email@hidden>
- Date: Sun, 14 Apr 2002 08:57:47 -0500
Hello!
Wow, I feel kinda dumb :-) But....I have another problem, my new
and open are still disabled. I am assuming this is because I have
a bad target name coded. Here is my code:
[toolbarItem setLabel: @"Open"];
[toolbarItem setPaletteLabel: @"Open"];
[toolbarItem setToolTip: @"Open An Existing Document"];
[toolbarItem setImage: [NSImage imageNamed: @"Open Small"]];
[toolbarItem setTarget: self];
[toolbarItem setAction: @selector(openDocument:)];
[toolbarItem setLabel: @"New"];
[toolbarItem setPaletteLabel: @"New"];
[toolbarItem setToolTip: @"Creat A New Document"];
[toolbarItem setImage: [NSImage imageNamed: @"New"]];
[toolbarItem setTarget: self];
[toolbarItem setAction: @selector(newDocument:)];
Instead of [toolbarItem setTarget: self]; I am thinking it
should be something else. Any clue?
Thanks again!
Albert
On Sunday, April 14, 2002, at 08:39 AM, j o a r wrote:
On Sunday, April 14, 2002, at 03:19 , Albert Atkinson wrote:
Anyone have any suggestions?
Yes! :)
1) validateToolbarItem is only called in the target of the toolbar
item - and since you have set the drawer itself to be the target
this method will never be called for this toolbar item.
The built in fallback to using validateToolbarItem is to check
wether the target responds to the provided action method, which
brings us to:
2) NSDrawer doesn't implement "toggleDrawer:". Change it to match
the correct method:
- (void)toggle:(id)sender
ie.: [toolbarItem setAction: @selector(toggle:)]
...and then the toolbar item, as if by magic, will be enabled!
j o a r
_______________________________________________
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.