h1

Carbon/Cocoa difference Number 2

April 9, 2007

Here’s another little wrinkle that I stumbled upon.

Cocoa Application

1. Create a document in TextEdit and make some changes
2. Press ‘apple-w’ to close the window
3. A ‘sheet’ appears with the normal options of ‘Don’t Save’, ‘Cancel’ and ‘Save’
4. Press ‘apple-d’ and the document closes without saving.

Carbon Application

1. Create a document in Photoshop and make some changes
2. Press ‘apple-w’ to close the window
3. A dialogue box appears with the normal options of ‘Don’t Save’, ‘Cancel’ and ‘Save’
4. Press ‘d’ and the document closes without saving.

In the Carbon Application there is no need to press ‘command-d’ a single press of ‘d’ will suffice. However, ‘command-d’ works as well.

Again I’m not sure if this is in the relevant API or just the way Adobe has coded it, but the correct behaviour should be described in the Human Interface Guidelines. Downloading the latest version as pdf revealed 6 instances of ‘Don’t Save’ in the HIG searching with Acrobat. But none of these instances described the keyboard short cut.

In APPENDDIX A – Keyboard Shortcuts Quick Reference in the HIG on page 313 there is no reference to ‘d’ by itself or in combination with ‘command’.

In the NSAlert_Class Reference on page 9 (when downloaded as a pdf) ‘command-d’ is specifically mentioned.

By default, the first button has a key equivalent of Return, any button with a title of “Cancel” has a key equivalent of Escape, and any button with the title “Don’t Save” has a key equivalent of Command-d (but only if it is not the first button).

The HIG assumes a left to right reading language but the NSAlert_Class places the first button at the right of a dialogue box or sheet.

UPDATE

I’ve been given some guidance concerning this from Betalogue http://www.betalogue.com/

The “d” shortcut (without the command key) is actually something introduced by Adobe and Microsoft. It’s copied from the Windows side. It’s not the standard Mac approach. The standard Mac approach, as described in the HIG, is to use command-D.

So this is not a difference between Cocoa and Carbon, but a problem with Adobe and Microsoft not following Apple’s guidelines.

I am afraid Adobe and Microsoft are guilty of multiple “infractions” of this kind. Since their applications happen to be Carbon, it can be misleading. But BBEdit is a Carbon application, for example, and doesn’t support “d” without the command key in this scenario

I didn’t know that and really appreciate the input. Let’s see what happens with CS3 and how Adobe implements the code in that. I suspect it will remain for legacy reasons, but there again Adobe aren’t happy unless they change a key stroke or two.

Merci beaucoup Pierre

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: