SIL LSDev Linux Development

Language software for Linux and Mac OS X

The look and feel of cross-platform user interfaces

Someone just asked me,

What’s the best way to do a cross-platform product that has the native XXX look and feel?

It depends on exactly what you mean by native look and feel. There are several GUI toolkits that produce the right pixels, so that in a screen shot it would look just like an XXX application, but which still don’t produce an application that feels right. For example, on Mac, if you select a range of text and then press right-arrow, what happens? The insertion point should move to the right boundary of the previous selection. However, on Windows, it typically moves one character beyond that point. I find this inconsistency very frustrating in several of the cross-platform apps that I use regularly.

Also, applications may have the right pixels for all the individual controls, but the overall layout of their UI doesn’t feel comfortable for an XXX user. The classic example is the relative ordering of OK and Cancel buttons in dialogs. Most toolkits now take care of this transparently, but there are other things, such as the extent to which toolbars are used, that can be uncomfortable for users. For example, Mac applications typically use toolbars very sparingly, and Windows apps use them extensively.

Will Mono produce native Mac look and feel? How about Java? Python?

The look and feel is determined mostly by the choice of UI toolkit, and the way the UI is laid out, and very little by the choice of programming language. Most toolkits can be used from most languages.

The three leading cross-platform toolkits, Qt, GTK and wxWidgets can all be used from .Net, Python and a variety of other languages. .Net (and Mono) also support Windows Forms, the UI toolkit provided in .Net, but from what I have seen so far it doesn’t produce nice UIs on anything but Windows (surprise!).

Java programs typically use Swing, which does a fairly good job of producing a native Mac look and feel, especially since Apple has helped with the development of the Mac version of Swing, but many of the cross-platform annoyances I mentioned above still apply, unless the application designers have taken special care to produce a good Mac version.

What’s the best way to produce a native look and feel using Python on the Mac?

PyObjC is a bridging technology between Python and Objective-C. This allows you to use Cocoa from Python. If you want the ultimate in native look and feel on the Mac, using Cocoa is probably the way to go, but of course this is completely non-portable. Cocoa can be used from other languages, too, including .Net ones (Cocoa#).

PyObjC makes use of InterfaceBuilder, which is the layout designer for Cocoa. Almost all toolkits offer an interactive GUI layout designer, which saves the layout definition in a data file (or sometimes in source code) for the application to pick up and use at run time.

Although Cocoa produces the best look and feel, I believe it is also possible to get very close with the various cross-platform toolkits, if appropriate care is taken.

wxWidgets uses a different approach from the other toolkits, in that is a wrapper for the native widgets (aka controls) of whichever platform it is running on. This takes care of a lot of look and feel issues, but I have still seen a good number of wx programs that didn’t feel right on the Mac, and I believe the same sort of thing would apply on other platforms. Programs tend to take on the feel of whichever platform they started on (or whichever platform the programmer is most familiar with).

One Response to “The look and feel of cross-platform user interfaces”

  1. 76Michell says:

    Hello blogger, i must say you have hi quality posts here.
    Your website can go viral. You need initial traffic
    boost only. How to get it? Search for: Mertiso’s tips go
    viral

Leave a Reply