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: Sat, 13 Apr 2002 12:58:26 -0500
Hello!
Thanks for your help! I set this up in my app code and ran the
thing. For some reason the toolbar item is disabled though. Does
anyone know why? Here is the code:
if([itemIdent isEqual: SpeechDocToolbarItemIdentifier]) {
// Set the text label to be displayed in the toolbar and
customization palette
[toolbarItem setLabel: @"Speech"];
[toolbarItem setPaletteLabel: @"Speech"];
// Set up a reasonable tooltip, and image Note, these aren't
localized, but you will likely want to localize many of the item's
properties
[toolbarItem setToolTip: @"Show Speech Drawer"];
[toolbarItem setImage: [NSImage imageNamed: @"Speechs"]];
// Tell the item what message to send when it is clicked
[toolbarItem setTarget: speechDrawer];
[toolbarItem setAction: @selector(toggleDrawer:)];
} else {
toolbarItem = nil;
}
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.