24 Oct 2004 elanthis   » (Journeyer)

Cross Platform GUIs: Reloaded

haruspex: Unfortunately, that isn't true. There is *no* pure-technical mechanism (framework/API) that can cover the differences between platforms. You will, at the very, very least, need to redesign GUI description files for each target OS.

If you are talking only about the low-level API, GTK+ probably works Well Enough. It is of course the native toolkit for GNOME, can be made to use Qt for drawing widgets in KDE, can be made to use the Win32 API for drawing widgets in Windows, and (if someone cared enough to bother) it could be made to use Aqua to draw widgets in OS X. The widgets themselves would be Close Enough.

There is no way to write a "high level" description that is *actually* going to be cross platform. Why? Because you can't write a high level description of what the application does and expect to have a computer figure out what to do with it. (If we could, we wouldn't be programming anymore - we'd just type in "manage finances" and the computer would write gnucash or something for us.)

The problem is that the differences between platforms can run rather deep. File saving might differ between having you explicitly save to a file and having the content constantly updated in a database meta-filesystem. That's an extreme example.

A real-world "today" example would be in custom dialogs. If it's a preferences dialog, then is it instant-apply or not? What about button labelling? The actual label you use can vary a lot for each platform. Do you *really* expect developers to, for each button, enter 2 to 4 different labels? What happens when a new platform comes out that needs a new label?

Using something like GTK, you can at least standardize the API, and then use Glade to ship completely different UI files for each platform. For new platforms, you can just drop in a new glade file (perhaps users can write their own, too).

Another problem, even when using GTK, is that you are locked into an LCD system. If a platform has a particular feature that no other platform has, you can't code against that feature.

If you break up your application properly, recoding the GUI for each platform should not be a major issue. You can also fine-tune and tweak the GUI for each platform to perfection.

[#] Comments

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!