Can I mix Carbon and Cocoa? lazarus / 33-macOS - Mac OS X ---------------------------------------------------------------------- LazProgger · 2016-05-13 11:31 Lazarus is creating Carbon applications by default. However, it is also possible to add CocoaAll to the uses clause to access the Cocoa API functions. When trying to find equivalents for the Windows API functions, sometimes I find Carbon functions, sometimes Cocoa functions. So, before I start: Can I mix those functions (for example using a Carbon function for this task, a Cocoa function for that task) or is it better to create a program that only use Cocoa OR Carbon? ---------------------------------------------------------------------- Jonas Maebe · 2016-05-13 11:34 Yes, you can mix them. The Cocoa and Carbon frameworks are also in part built on the same lower level frameworks. ---------------------------------------------------------------------- LazProgger · 2016-05-13 12:06 Okay that's good to know. So there cannot arise any problems from mixing them? Have you one of them that you prefer? As far as I have seen, some tasks can be better solved with Carbon others with Cocoa. Or am I completely wrong? ---------------------------------------------------------------------- Jonas Maebe · 2016-05-13 13:23 In general, Cocoa is more future proof, as most of Carbon has been deprecated. Some parts are still supported though, and parts of Cocoa even build on those parts of Carbon. You'll have to consult Apple's documentation to know what is support and what not (anything not supported is marked as legacy or unavailable under 64 bit). Personally, I don't do any Carbon nor Cocoa programming, so I can't really help you with that. I just know about the general situation. ---------------------------------------------------------------------- skalogryz · 2016-05-13 16:00 Quote from: LazProgger on May 13, 2016, 02:06:49 pmOkay that's good to know. So there cannot arise any problems from mixing them? Have you one of them that you prefer? As far as I have seen, some tasks can be better solved with Carbon others with Cocoa. Or am I completely wrong? It depends on how you mix them. For example, if you start an event queue with Carbon and then run event queue with Cocoa you might get into trouble. If you try to mix Carbon controls with Cocoa controls, it's unlikely to work either. I can use Icon tray, as an example of successful mix. IconTrays API are Cocoa only (there're no Carbon counterparts), however Carbon widgetset IS using Cocoa APIs for Icon tray support. ---------------------------------------------------------------------- LazProgger · 2016-05-14 12:05 Thank you very much.