Carbon Declare Library
Issue: 1.2 (October/November 2002)
Author: Greg Fiumara
Article Description: No description available.
Article Length (in bytes): 4,157
Starting Page Number: 8
Article Number: 1103
Related Web Link(s):
Excerpt of article text...
With the release of Mac OS X.1 and the Cocoa programming language, many REALbasic programmers have found that the user interfaces of their applications don't quite cut it anymore. With the introduction of OS X, the Cocoa API (accessed by programs developed with Project Builder from Apple) has upped the ante for interface design on the Mac. Cocoa developers get all of the Aqua interface goodies, from anti-aliased text to window menus, for free. You don't have to learn a whole new programming language though, you just have to write all of the Carbon Declares (calls to the Macintosh Toolbox) yourself. Challenging, yes, unless it is already done for you, as it is with Carbon Declare Library (CDL).
CDL is available for free download as a module you simply drag-and-drop into the REALbasic project window. The set of functions in this module is almost too good to be true. For example, with just one line of code calling the function
createWindowMenu, you can create a window menu (showing all open windows, zoom window, etc.) that even automatically updates with every opened and closed window, without any extra code. Intimidated by Cocoa applications' error dialogs? With CDL, just specify all the information that you want in the dialog, such as the number of buttons, the error message, or the icon, and you're done; again with one line of code. If that isn't enough, you can create sheet dialogs and even make them transparent. Ever pressed the resize button in a Cocoa application and watched the window resize smoothly? With CDL, type in the size you wish to resize the window to and you get the same effect in REALbasic.
The inspiration behind this library of code was to keep people from having to ask the same questions over and over again on the REALbasic e-mail lists. The original set of code, first compiled by Jarvis Badgley in November 2001, contained only 7 functions. With the help of many questions asked to the lists and many hard working developers armed with a copy of TBFinder and Apple's Universal Headers, code snippets were being sent left and right for inclusion into this library. At press time, the latest release of CDL (June 28, 2002), had well over 100 functions, and continues to grow daily.
...End of Excerpt. Please purchase the magazine to read the full article.