image ResEx Logo
ResExcellence www : Powered by Google
Cell Phone Themes Icons Mighty Mouse Cursors Software Reviews Widgets & Widgets

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
by Clayton E., Crooks II


REALbasic for Macintosh
by Michael Swaine


REALbasic Cross-Platform Application Development
by Mark S. Choate





Older files are in Stuffit 5 or greater format. Newer files are ".Zip". Download StuffIt Expander
Tell us about a bad link. Thank You!

Background Applications by Erick Tejkowsi
05-02-03

Printer Version




It's easier than ever to create background applications in Mac OS X. However, to convert a REALbasic-made application to a background application, you'll need to have a trick or two up your sleeve. This week we'll show you how to make a REALbasic application hide in the background. We'll also build a small tool to automate the process, so you don't have to think about this again.

Backgrounding Background
A background application is handy for times when:

  • you don't want its icon to appear in the Dock
  • a daemon-like utility,
  • or just when you're trying to be tricky. :-)
For Cocoa applications and Carbon applications that use plist files, changing a standard application to a background one is simply a matter of adding the following code to that file:

Pretty simple, eh? When you build a Mac OS X application with REALbasic, however, there isn't one of these plist files to be found. All you have is an executable file. Look inside the resource fork with your favorite resource editor and you'll find the plist information in the 'plist' resource. Scroll to the end of that resource and locate this tidbit:

05-02-03.jpg (55k)

You could paste in the NSUIElement key listed above, but why bother. Not only do you have to poke around the resource fork and enter some text, you also have to edit the hex code of that character between the two lines in the previoes XML code to chr(13). That's too much of a pain for lazy programmers... especially when you want to debug a background application, where you might have to repeat this resource process dozens of times. To make life simple, let's create a tool to do the job for us.

Build the Project
This project is super simple to build. Launch REALbasic and use the default Window1 in the new project. To the window's Open event, add this one line of code:

me.acceptFileDrop "any"

Then, in the DropObject event of Window1, add this code:

That's it! Build the application and run it. Now, whenever you drag a REALbasic-made OS X application into the window, it will instantly transform into a background application. When you create a background application, don't forget to give yourself a way to quit it, since the menubar won't be available.

Conclusion
As usual, you can download the code for this week's project. See you next week!




Cell Phone Themes Icons Mighty Mouse Cursors Software Reviews Widgets & Widgets

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]