PDA

View Full Version : Cocoa Development Questions: Enclosing Windows of Toolbar Items, Sheets


simX
Jun 21, 2004, 05:26 AM
I have two random questions about Cocoa development. First, I'm trying to implement a portable class that contains two sheets; these sheets will attach to any window that supports a certain method that I implement. The thing is that I can't attach the same sheet to multiple windows, so I created a class based on a separate nib file, which I can use simply by instantiating the custom class to get a new set of sheets to use on the windows that need it.

The only problem seems to be that when I try to activate one of the sheets inside this nib file on a window that's not in the nib file, I get a "Modal session requires modal window" exception. Does that mean that I can only attach a sheet to a window in the same nib file as the sheet? And if so, how do I get around my original problem -- i.e.: how should I create sheets so that I can attach them to any window that needs it, without running into the limitation where any one sheet can only be attached to one window? (Let me know if this whole question makes sense.)

Also, I was also wondering if there's a way to get which window contains a toolbar item that was clicked, since it sends the toolbar item as the sender to the method that responds to the click. I've got a bunch of different windows that have the same toolbar, and there doesn't seem to be a way to differentiate between a toolbar button click in one window from another, given that they're all synchronized since they use the same toolbar identifier. I've looked through the methods implemented by NSToolbarItem and NSToolbar, but none of them seem to be able to give me the window that contains the toolbar or toolbar item.

Any help would be much appreciated. Thanks.

mainstreetmark
Jun 21, 2004, 09:02 AM
Try these guys. You may get a better answer.

This forum is mostly for people complaining about the lack of video iPods and 4-processor G5 systems.

http://www.cocoadev.com/
http://cocoadevcentral.com/
http://macdevcenter.com/