• 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: Calling IB Actions In PB
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: Using Cocoa Programmatically
  • Next by Date: Loop through NSTableView to set NSCell state
  • Previous by thread: Re: Calling IB Actions In PB
  • Next by thread: Re: Calling IB Actions In PB
  • Index(es):
    • Date
    • Thread