• 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:19:03 -0500

Hello!

OK, I added the following code:

- (BOOL) validateToolbarItem: (NSToolbarItem *) toolbarItem {
BOOL enable = NO;
if ([[toolbarItem itemIdentifier] isEqual: SaveDocToolbarItemIdentifier]) {
enable = [self isDocumentEdited];
} else if ([[toolbarItem itemIdentifier] isEqual: NSToolbarPrintItemIdentifier]) {
enable = YES;
} else if ([[toolbarItem itemIdentifier] isEqual: SpeechDocToolbarItemIdentifier]) {
enable = YES;
}
return enable;
}

It will enable the Save toolbar item and the Print toolbar item but the Speech is still disabled. Here is the code I have in the Speech setup area:

[toolbarItem setLabel: @"Speech"];
[toolbarItem setPaletteLabel: @"Speech"];

[toolbarItem setToolTip: @"Show Speech Drawer"];
[toolbarItem setImage: [NSImage imageNamed: @"Speechs"]];

[toolbarItem setTarget: speechDrawer];
[toolbarItem setAction: @selector(toggleDrawer:)];

Anyone have any suggestions?

Thanks!

Albert


On Saturday, April 13, 2002, at 12:51 PM, David Remahl wrote:

[myToolbarItem setTarget:yourDrawer];

/ David

Hello!

Yes, this is exactly what I was asking. However, how do I let the
app know which drawer to toggle?

Sorry about the dumb questions...I am pretty new.

Thanks!

Albert

On Saturday, April 13, 2002, at 12:39 PM, Andy Lee wrote:

At 12:01 PM -0500 4/13/02, Albert Atkinson wrote:
How do I call common actions in IB using PB? For example I would
like to use the toggleDrawer: action but since I am using a
toolbar I need to hard code it so is there any way I can make
reference to toggleDrawer: ?

If I understand correctly, you are asking how to refer to the
-toggleDrawer: action in Objective-C code as opposed to making the
connection graphically in Interface Builder.

Here's how:

[myToolbarItem setAction:@selector(toggleDrawer:)];

The @selector() directive lets you refer to method names. An
action is just a method. Note that the colons in method names are
significant, so don't make the following easy-to-make typo:

[myToolbarItem setAction:@selector(toggleDrawer)]; // WRONG

--Andy
_______________________________________________
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.

  • Follow-Ups:
    • Re: Calling IB Actions In PB
      • From: j o a r <email@hidden>
References: 
 >Re: Calling IB Actions In PB (From: Albert Atkinson <email@hidden>)

  • Prev by Date: Setting cursor position
  • Next by Date: Re: Calling IB Actions In PB
  • Previous by thread: Re: Calling IB Actions In PB
  • Next by thread: Re: Calling IB Actions In PB
  • Index(es):
    • Date
    • Thread