Filed under: Software, Other Events, Apple
C4 Tip: Drag-and-drop text in Cocoa apps
During The Grube's UI presentation at C4, he pointed to one particular example of "functional inconsistency" in Apple's software: the discrepancy in results when you drag-and-drop text in Carbon apps (TextWrangler, AppleWorks, etc.) vs. Cocoa apps (TextEdit, Safari, etc.).When you select text in Carbon applications, you're able to drag the text by simply clicking the selection and dragging it. In Cocoa apps, however, you need to click the selected text and hold the mouse button down for a fraction of a second before you're able to drag it. Your cursor changes from the text selector to the pointer. But clicking and immediately dragging results in you re-selecting the text.
The Cocoa differentiation is a result of NeXT designing a way to enable both dragging and re-selecting, which was carried into OS X.
It's a minor inconsistency, but has frustrated me countless times. Glad that's all cleared up.
Thanks John!

![TUAW [Cafepress]](http://www.blogsmithmedia.com/www.tuaw.com/media/tuaw-cafepress-promo.png)


Reader Comments (Page 1 of 1)
GPSNavX said 9:33PM on 10-21-2006
Is anyone still using Carbon to develop OS X apps? If so why?
Reply
Ryan said 10:15PM on 10-21-2006
Interesting - When I select text on this page in a camino window, i have to immediatly drag it away for it to get dragged anywhere (eg to a text clipping on the desktop).
In a Safari window, it the complete opposite - hold and then drag. I also get a nice semi-transparent representation of what exactly i'm dragging (eg a picture or some text) - proving that safari is a true cocoa application.
I was sure that camino must be a cocoa app. What gives? Im moving back to safari when 10.5 is out.
Reply
Appleologist said 11:08PM on 10-21-2006
The Cocoa interface really is what makes OS X so different from Windows and other OSes. Its the "alive" and clean feeling you get when you use a Cocoa app that makes Mac OS X so special.
There are rumors that 10.5 Tiger will significantly improve the interface of Carbon applications and unify the experience, for applications such as Adobe Creative Suite and Microsoft Office. But until then, I suggest finding Cocoa alternatives to Carbon applications.
Reply
The Hater said 12:41AM on 10-22-2006
Holy hell, you can't mean that...
...
Okay, you meant it. F**king hell, why did they do that? Someone dosed rather heavily before their usability design session...
Reply
Macskeeball said 12:45AM on 10-22-2006
Ryan, Camino uses Cocoa for the app's UI itself, but not for the content area. The content area uses Gecko.
Reply
Martin said 7:17AM on 10-22-2006
You can decrease the time you have to wait. See http://www.macosxhints.com/article.php?story=20051121074003638
Reply
bikeham said 8:17AM on 10-22-2006
I have found that cutting and pasteing is inconsistent in some apps. If I want to paste a note into the address book, the right click/paste doesn't work.
Reply
huh said 9:43AM on 10-22-2006
Did anyone of you work in Windows? It has exactly the same problems....
Reply
John said 1:32PM on 10-22-2006
I'd just like to point out that there is very good Carbon-Cocoa integration in Mac OS X. Carbon can fairly easily access Cocoa controls and interface widgets. The disadvantage is that's not cross-platform—which is, I think, a major reason to develop in Carbon.
Cocoa is an excellent way for Mac-only applications to reach their full potential quickly, which is why it's generally become synonymous with "pretty" Mac applications.
Reply
Mr Lizard said 6:36PM on 10-22-2006
Excuse my ignorance- what is there difference between a Carbon app and a Cocoa one?
Reply
Macskeeball said 10:09PM on 10-22-2006
John, the (optional) cross platform compatibility of Carbon you mentioned referred to compatibility with both Mac OS Classic and Mac OS X. It doesn't mean that Carbon apps can run on Windows or Linux, etc. Another reason some developers like Carbon is that it's somehow similar to programming for OS 9 (relatively minor modifications required to Carbonize a Classic app).
Mr. Lizard, my limited understanding of it is that Carbon and Cocoa are both APIs (application programming interfaces) that developers use to make programs for Mac OS X. As mentioned in the previous paragraph, Carbon has the (optional) ability to run on both Mac OS X and Mac OS Classic and is also easier to port from mac OS Classic with. On the other hand, Cocoa provides a lot of features (spell checking, font panel, find and replace, and a lot more) without the developers having to do much work (if any). Carbon can access those same features, but it's more work.
Reply
John said 11:07AM on 10-23-2006
The cross-platform compatibility I referred to was the fact that Carbon uses a C API, like most other platforms today, whereas Cocoa uses Objective-C with Apple-specific extensions. Carbon is much closer ground to most other platforms; porting to the Mac is often done through it.
Reply