Re: Interface Builder (almost) supports NSToolbar

2008-03-24 Thread Karl Moskowski
If you're creating a toolbar for which all items should be selectable,  
instead of binding each of the toolbar's items separately or iterating  
over them all and building an array, you can just use KVC to get an  
array of all items' identifiers.


// NSToolbar delegate method
- (NSArray *) toolbarSelectableItemIdentifiers:(NSToolbar*) toolbar {
return [[myToolbar items] valueForKey:@itemIdentifier];
}

(For my prefs window toolbar, this is the only delegate method I've  
implemented.)



Karl Moskowski [EMAIL PROTECTED]
Voodoo Ergonomics Inc. http://voodooergonomics.com/



smime.p7s
Description: S/MIME cryptographic signature
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Re: Interface Builder (almost) supports NSToolbar

2008-03-04 Thread Brian Krisler

I am not sure I fully understand your solution.  I can bind all my IB
created NSToolbarItems, however there is no way to change the
identifier on already created items from within the awakeFromNIB,
or from init.

If I add the item using the delegate, I just get a duplicate item in  
the toolbar.


Am I missing something?

Brian


On Mar 3, 2008, at 2:12 PM, Quincey Morris wrote:



On Mar 3, 2008, at 10:53, Brian Krisler wrote:

I have discovered that it is now almost possible to create  
toolbars from within
Interface builder, with one big exception.   There appears to be no  
way to

define identifiers for the toolbar items.

Is this a sign of future functionality?  I can not find any  
documentation
on NSToolbar within IB, every document I can find explains how to  
implement

toolbars from code, using delegates.

After more exploring, I discovered that I could open the XIB file  
in an XML editor,
and define the identifiers for my items (they were set to GUID's).   
After renaming
them to understandable values, I was then able to specify their  
selected state

from within the code, using my identifiers.

There are a few inspector values that I am not sure exactly what  
they do yet, they

appear to have no direct function.

Has anyone had experience, good or bad, with creating toolbars from  
IB?


I had the same kind of WTF?!? reaction to the IB's toolbars, until I  
guessed you're apparently supposed to do the blindingly obvious:  
create IBOutlets for each toolbar item you care about in your window  
controller class, hook them up in IB, and do whatever (such as  
assigning identifiers, or making certain items selectable) in the  
window controller's nib-awake-time code, or its toolbar-delegate  
methods.


It feels a little hokey using outlets for this, but it works fine.




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Interface Builder (almost) supports NSToolbar

2008-03-04 Thread Jonathan Hess

Hey Brian -

Until IB allows you to set the identifier, I would do this instead:  
Add an outlet to your controller, something like IBOutlet  
NSToolbarItem *myItem. Connect that to the item who's identifier you  
are interested in IB. Now, every place were you wanted to use a custom  
identifier for 'myItem' use [myItem identifier] instead.


Jon Hess


On Mar 4, 2008, at 6:04 PM, Brian Krisler wrote:


I am not sure I fully understand your solution.  I can bind all my IB
created NSToolbarItems, however there is no way to change the
identifier on already created items from within the awakeFromNIB,
or from init.

If I add the item using the delegate, I just get a duplicate item in  
the toolbar.


Am I missing something?

Brian


On Mar 3, 2008, at 2:12 PM, Quincey Morris wrote:



On Mar 3, 2008, at 10:53, Brian Krisler wrote:

I have discovered that it is now almost possible to create  
toolbars from within
Interface builder, with one big exception.   There appears to be  
no way to

define identifiers for the toolbar items.

Is this a sign of future functionality?  I can not find any  
documentation
on NSToolbar within IB, every document I can find explains how to  
implement

toolbars from code, using delegates.

After more exploring, I discovered that I could open the XIB file  
in an XML editor,
and define the identifiers for my items (they were set to  
GUID's).  After renaming
them to understandable values, I was then able to specify their  
selected state

from within the code, using my identifiers.

There are a few inspector values that I am not sure exactly what  
they do yet, they

appear to have no direct function.

Has anyone had experience, good or bad, with creating toolbars  
from IB?


I had the same kind of WTF?!? reaction to the IB's toolbars, until  
I guessed you're apparently supposed to do the blindingly obvious:  
create IBOutlets for each toolbar item you care about in your  
window controller class, hook them up in IB, and do whatever (such  
as assigning identifiers, or making certain items selectable) in  
the window controller's nib-awake-time code, or its toolbar- 
delegate methods.


It feels a little hokey using outlets for this, but it works fine.




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/jhess%40apple.com

This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Interface Builder (almost) supports NSToolbar

2008-03-03 Thread Quincey Morris


On Mar 3, 2008, at 10:53, Brian Krisler wrote:

I have discovered that it is now almost possible to create  
toolbars from within
Interface builder, with one big exception.   There appears to be no  
way to

define identifiers for the toolbar items.

Is this a sign of future functionality?  I can not find any  
documentation
on NSToolbar within IB, every document I can find explains how to  
implement

toolbars from code, using delegates.

After more exploring, I discovered that I could open the XIB file in  
an XML editor,
and define the identifiers for my items (they were set to GUID's).   
After renaming
them to understandable values, I was then able to specify their  
selected state

from within the code, using my identifiers.

There are a few inspector values that I am not sure exactly what  
they do yet, they

appear to have no direct function.

Has anyone had experience, good or bad, with creating toolbars from  
IB?


I had the same kind of WTF?!? reaction to the IB's toolbars, until I  
guessed you're apparently supposed to do the blindingly obvious:  
create IBOutlets for each toolbar item you care about in your window  
controller class, hook them up in IB, and do whatever (such as  
assigning identifiers, or making certain items selectable) in the  
window controller's nib-awake-time code, or its toolbar-delegate  
methods.


It feels a little hokey using outlets for this, but it works fine.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]