On 23/10/2008, at 12:33 PM, Quincey Morris wrote:

On Oct 22, 2008, at 17:39, Graham Cox wrote:

I can place a toolbar in my window, and I can add items to it. I can set the delegate outlet of the toolbar to my document controller.

What I can't do is to tie any outlets to the toolbar items or set any actions or targets for the items. IB's interface doesn't even let me select the items individually, and I cannot assign my own identifiers to them.

At runtime, when the nib is loaded, the pre-installed items are there but they have been assigned identifiers which are UUID strings. My delegate gets called and I can add additional custom items just as I would if I were doing it all in code, but for the nib-supplied items, I get nothing. Since the identifiers are assigned UUIDs somewhere there's no way to know what identifier to use to retrieve an item from the bar and fix up its target/action.

The whole ability to set up toolbars in IB appears to be useless to me.

So before I ditch it all and go back to doing it the harder-but- saner way, can anyone point me in the direction of something that will help me make any sense of this?

The identifier thing is annoying. There isn't any way to set your own. The best alternative seems to be to create an outlet for each toolbar item you need to refer to in code, and hook them up in IB. Then you can extract the identifier via the outlet if you need it.

You could implement NSToolbar's toolbarWillAddItem: delegate method, for example, and build a collection of toolbar items.

The toolbar that IB shows you in its owner window is actually the default set of items, and you can't select them individually there. To get the full set of items, you click on the toolbar once to select it, then again so that the "allowed items" sheet slides out, and you can select individual items in that sheet. Click once to select the toolbar item, click again to select the underlying control.

There were some bugs in IB's toolbar handling, where it wouldn't save the toolbar after you changed it. I'm not sure if that bug is still in the shipping 3.1 version. (The only workaround I found was to put a separator item at the beginning and the end of the toolbar. Then it seemed to save OK.)

HTH

The bug seems to be there still.

Kiel

_______________________________________________

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]

Reply via email to