Articles 3D Audio Custom Controls General RB Graphics Hacks Mac OS X Menus Novelty Printing REALbasic 2005 REALbasic 2006 Registration Resources Reviews Serial Speech Sockets XML Video Resource Links News Current News February 2006 January 2006 December 2005 November 2005 October 2005 September 2005 August 2005 July 2005 June 2005 May 2005 April 2005 March 2005 ![]() REALbasic for Dummies by Erick Tejkowski ![]() Learning REALbasic through Applications REALbasic for Macintosh REALbasic Cross-Platform Application Development
Older files are in Stuffit 5 or greater format. Newer files are ".Zip". Download StuffIt Expander |
|
Introduction Today's project requires that you first go to Will Cosgrove's site to download his Carbon Events Plugin. He charges a nominal fee to use the plug-in, but it's well worth it if you are a Mac OS X developer. The plug-in adds all sorts of useful OS X functions to REALbasic. The demo plug-in will let you see how it works and is functional enough to complete this tutorial. Interface The interface for today is very stripped down. In fact, there really isn't an interface except for the the items listed in the Dock. After installing the plug-in in the Plugins folder, launch REALbasic and select Edit-Project Settings. Choose "None" from the "Default Window" popup menu.
Next, create a new class by selecting File-New Class. Name the class "app" and choose "DockMenuApplication" for the Super property.
Source Code The code for today's project is also pretty simple. We will add a list of our favorite sites (sites that require passwords) to the popup menu of our application's Dock icon. Navigate to the Open event of the app class and enter the following code: Finally, navigate to the HandleDockMenu event of the app class and add this code: This list of passwords is fake, but you get the idea. Whenever a user chooses, say, AppleCare from the Dock menu, the HandleDockMenu event fires giving us the dock menu item's index. We then use that index to learn about the text that is contained in that menu item and act accordingly by pasting a "password" to the clipboard. A resourceful REALbasic programmer will notice that this project can be improved in many ways. Generally it is a bad idea to hard code information like passwords and web site names. These clearly would have a better home in a text file. That way you could add more links to the list later and the application will just display them. For the sake of this demo, we chose to hard code the information. Conclusion Well, that's it for this week! As usual, you can download the finished project in case you get stuck. Have fun and see you next week! |
||||
|
||||||||||||||||||||||||||||||||
Maintained by the Staff of ResExcellence. This entire site ©1997-2006 ResExcellence
Privacy Statement? Sure we gotta Privacy Statement.
[an error occurred while processing this directive]