NSToolbar error when customizing the toolbar

Hello everyone,

First of all thanks to all the wonderful people who have taken the time to answer questions on these forums. Your responses to other people’s questions have been really helpful to me as I try to learn how to use AppleScript Studio.

I am posting to ask if anyone knows a way to solve this problem:

I am using Leopard and there is a new 10.5-only way to add a toolbar directly in Interface Builder without using the dynamic creation method demonstrated in the Sample application Simple Toolbar.

This was very intuitive, easy to use and the buttons respond nicely to the usual “on clicked” handler (instead of the toolbar clicked handler used in Simple Toolbar).

However, when you permit customization of the toolbar, and either 1) add a button not already on the toolbar or 2) destroy a button that was working fine by dragging it away from the toolbar and then add it again etc. you get the following sort of error when pushing the button (that works fine if originally on the toolbar and not fiddled with):

“Can’t get toolbar item id 12 of toolbar of window id 11. (-1728)”

I didn’t see any reference to this problem here at MacScripter but found a message on the Apple mailing list reporting the same problem here in December 2007:

http://lists.apple.com/archives/applescript-studio/2008/Jan/msg00000.html

Matt Neuburg (as in the author of The Book and AppleScript guru) responded to this with:

“You’re not doing anything wrong. Remember, ASS has not evolved since
Panther, so Tiger and Leopard interface objects such as the new toolbar
architecture in Leopard’s version of Cocoa are not well supported. Either
don’t let your toolbar be customizable or else link against Tiger (not
Leopard) and do toolbars the old way (see the Simple Toolbar example on your
hard disk) and I think you’ll be fine. m.”

I wanted to ask if this is the consensus ie. that this is an insolvable ASS bug and there is no way to fix this problem and correctly communicate with this buttons that have been added or re-added via the customization tab unless I redo the entire toolbar via a dynamic construction?

Respectfully,

K. M. Lawson
http://foolsworkshop.com/applescript/

XCode 3.1

Model: MacBook Pro
Browser: Safari 525.18
Operating System: Mac OS X (10.5)

Well I had just come here to find out about how to customize my toolbar, so I’m glad I came across your post. Since I used the “new 10.5 only” way to create my toolbar I guess customization is not something I want to enable right now. My program is already a 10.5 only application because I used several other things that were 10.5 only too so it’s not a big deal.

Anyway I posted earlier with a toolbar issue and ended up finding something similar. Basically only buttons work on the 10.5 toolbar, at least that’s my conclusion based on limited testing. You can see my thread here.

Thanks for that update and your link to the other posting. Does anyone else have experiences with this or work around for either of these problems? This looks like it will be problem for anyone who comes along and thinks they have discovered an easy way to make great toolbars directly through Interface Builder.

Model: MacBook Pro
Browser: Safari 525.18
Operating System: Mac OS X (10.5)