Maybe I didn’t read the docs carefully enough, but I wanted to know if it’s possible to use alert levels with the NSAlert of MyriadHelpers, that is, to specify “Note”, “Caution” or “Stop” icon?
For the time being I just use an ImageView and put the icon before invoking the alert, but
a) I have to store icon images into the bundle – 30K each, that’s more than my code size (13K).
b) They are not so nice as the original ones (you know, the app icon overlapped with alert icon.)
Unfortunately, I’m not confident enough in Objective-C to modify Shane’s methods (I only replaced the %d in the NSLog parameters by %ld to get rid of Xcode warnings and was satisfied with the result – that’s it.)
Cocoa’s alert sheets know only the normal style (with application icon) and the critical style (application icon badged with the caution icon). The stop icon is AppleScript/AppleScript Studio only.
Normal style is the default style, to set the critical style insert this line
Stefan has given you the answer, but I’d point out that you can modify it further if you want, adding an accessory view or whatever. I was just trying to keep the number of arguments manageable.
Now I’m getting more confident in using Shane’s code, because I understand better what it’s doing (in ObjC). My alerts are now conforming to Apple’s standards and I could get rid of “Applescript” icon. And of course, of some lines of useless code.
My new app is no more using Applescript’s facilities to communicate with the Finder and other applications, so if I try to write pure Objective-C code, this app should be a good starting point (assuming the ASOC version is perfectly stable).