Back to Flex

May 18, 2008

Its been awhile and I’m back into Flex after treading the SWT / OS X waters.  Getting from idea to code to working application is definitely a faster cycle with Flex, although if you have requirements for a native looking desktop app, well, AIR isn’t quite there *yet*.  

However - for next-gen hybrid apps, the desktop look and feel (LAF) requirement seems to be less and less important.  A good example is comparing Twitterific (native?) and Pownce (AIR).  Both function very much alike and even have a similar LAF.  Outside of the debate of Twitter vs. Pownce, the installation and usability experience for the two is comparable.  

Perhaps we can thank the Web 2.0 generation for creating acceptance of a ‘meta’ LAF consisting of bubbly shiny glass, which really owes its inspiration to OS X anyway.

So what’s my point?  Nothing other than to announce my coding focus is back on Flex. I’ve had some ground to cover to catch up - most notably Blaze DS and Papervision 3D.  More posts on Flex coming… 


OS X Development at its finest!

May 11, 2008

This is development at its finest - three (3) 30″ Cinema Displays hooked into an 8 core 3.2 Ghz Mac Pro tower.  Unfortunately, this is not my daily setup - yet.  I was lucky enough to experience a week on this setup and experienced withdrawal when having to ‘downsize’ to my single 30″ display powered by my 17″ Macbook Pro.  The girl scout cookies were an added bonus! 


SWT / AWT bridge users meet Albireo

May 6, 2008

Yes its alpha and yes its a hard name to pronounce but it solved a lingering SWT / AWT bridge issue I was facing on OS X Leopard.  

Specifically, I had an issue with native dialogs such as DirectoryDialog and FileDialog on Leopard.  When these would pop up, they would fight for focus with the application window, resulting in flickering and non-functional controls. 

I’m happy to say that Albireo made problem go away!

http://www.eclipse.org/albireo/


Building OS X Install Packages with Ant

May 6, 2008

Lets say you want to create a nice installer for your OS X application that looks something like this -

Lets also say you want to it completely automated so you can do it with a simple one line command OR make it part of an integration build process.

Using XCode’s PackageMaker tool and ant, its pretty simple to create a build.xml that automatically creates a package for you.  In fact, its even easier for you because I’ve already created a sample project that does this!

Requirements

You will need the following tools

This article assumes you have are familiar with Apache ant.

Quick Start

Download the AntPackageMaker sample project -

  1. Open a teminal
  2. cd into its directory
  3. Type ‘ant’ 

This will create a package installer for the world famous TextEdit application in the directory ‘pkg’.  You can open this directory in Finder and double click ‘TextEdit.pkg’ to see the results!  Move on to the next section for customizing AntPackageMaker for your own project.

AntPackageMaker Project Overview

This sample project contains a template package to use for creating a customized package, a sample application (TextEdit.app) and ant files necesary to create the package.  

Files and Directories

  • build.xml - The ant build file
  • bundle/ - Put your application bundle here - i.e. MyApp.app.  Don’t forget to remove TextEdit.app!
  • pkg-src/ - The package template files
  • pkg.properties - The ant properties files for building the package

Customizing

Here’s what you need to do to customize this project for own app. 

  1. Copy your application into the ‘bundle’ directory. Make sure you remove TextEdit.app
  2. Customize the files License.rtf and Welcome.rtf in the ‘pkg-src’ directory.
  3. Change the background.gif image in the ‘pkg-src’ directory and, yes, it has to be a GIF.  
    TIP - Make sure you save it with transparency and set the transparency matte to #EEEEE
  4. Open pkg.properties in a text editor and change the values as necessary.  You could even use TextEdit - just make sure to keep the formatting pain text!

Here’s a look at pkg.properties - all you need to change is ‘pkg.name’ to the name of your application.

## Package Properties

# Application name - here we're bundling TextEdit
pkg.name=TextEdit

# Location for the application bundle, i.e. TextEdit
# This sample project has TextEdit in the local 'bundle' directory
pkg.bundle=${basedir}/bundle

# Directory where the package template lives
pkg.src.dir=${basedir}/pkg-src

# Directory where we will create the package
pkg.dir=${basedir}/pkg

# The actual package
pkg=${pkg.dir}/${pkg.name}.pkg

# The package Info.plist - gets autogenerated
pkg.info=${pkg.src.dir}/Info.plist

# The package Info.plist template to use
pkg.info.template=${pkg.info}.template

# The package Description.plist - gets autogenerated
pkg.description=${pkg.src.dir}/Description.plist

# The package Description.plist template to use
pkg.description.template=${pkg.info}.template

Usage

Feel free to use this however you wish! If it helps you out, I’d love to hear about it.


Handle Native OS X Application Events in SWT

May 3, 2008

If you’ve been stumped on how to cover that ‘last mile’ with making your SWT application look completely native on OS X, take a peek at the open source project Azureus.  In my case, I had 2 issues left to figure out -

  1. Capture and handle dock icon click events
  2. Add additional menu items to the application menu

Follow the link below and look at the class ‘CarbonUIEnhancer’.  This class demonstrates how to hook into OS X’s application menu and handle AppleScript events.

Browse Azureus swt.osx source package