Fog Creek Software
Discussion Board




GUI Portability

Joel seems to be a big VB fan. I was a VB fan as well, until I tried Delphi (No I dont have shares!). I found that with VB I had to write the GUI in VB and the body of the app in C or C++ to get the speed I wanted (Most of the apps were Windows client services, and the GUI was for configuration, or setup).

Since then I have found that I am writing more and more Windows/Unix cross platform apps where the GUI must run on both systems, and I have yet to find a good way of doing it.

C and C++ are pretty much source code compatable if I use gcc, and take care which system calls I use. Naturally writing a daemon is quite different between Windows and Unix, but that is no great problem, as once the code has been witten, it can be reused. Writing a platform independent GUI on the other hand is a nightmare.

I shy away from writing GUI's in C++ (maybe wrongly), and although Python based solutions work well, the resulting applications are far too dependant upon various library versions and of course the version of the Python interpreter itself. It goes without saying that the installation process is also a nightmare which gets worse as the number of components to install rises, as each Unix variant seems to have its own install method.

Here are a few solutions I have played with.

VB - Very nice but just for Windows.
Delphi (Kylix) - World class RAD tool, but only for Windows and Linux. If it was available for all UNIX platforms I would be using it now (Heads up Borland)
Python + TKinter - Works but not very nice, Seems to be fairly portable. No good RAD tool. Have to install python and several shared libraries for it to work.
Python + WxWindows  - Works well, is reasonably portable but no good RAD tool. Have to install python and several shared libraries for it to work.
GUI implemented in a web browser (DHTML, java script, DOM etc) - Can be done, but the differences between web browsers makes it nearly impossible. Very difficult to
Java -  Surpisingly slow. Have to install jre etc for it to work. Not as portable as it promises. GUI's written in Java are not particularly pleasing.
Perl - Tried it a while back, but found it syntactically too cryptic for professional purposes (maybe I should look again?).

Hava any of you out there seen something better??

Roger
Sunday, December 16, 2001

Have you looked at QT? It's solid, cross platform, and you get your choice of development languages (C++ and anything else with QT wrappers).

There are costs associated with developing with QT on windows and mac, but for free platforms, the GPL version provides what you need.

If you're set on python (and there are good reasons to be), then you might have a look at pyQT from theKompany.

http://www.thekompany.com/projects/pykde/index.php3

I prefer QT over most other things for it's cross-platform compatibility and the way it just makes sense to my object-oriented brain.

Also, if you are considering web interfaces, and you can reasonably target only DOM-compliant browsers, you might have a look at a project I run, http://netWindows.org

HTH,

Alex

--
Alex Russell
http://netWindows.org

Alex Russell
Sunday, December 16, 2001

Something to keep on eye on: REBOL (pronounced "rebel" -- http://www.rebol.com) is portable across versions of UNIX, Windows, Mac, etc. (Non-GUI version runs on over 40 platforms) Code from one platform runs seamlessly without modification on all others. No special libraries required.
REBOL is still a bit young... and needs to be quicker. When it ages a bit, it'll be a thing of beauty.

Non-programmer programmer
Sunday, December 16, 2001

Not to dissuade you from QT at all, but - QT really works best in C++, whereas the Python binding is IMHO nothing more than a cute hack... QT's object model is tightly bound to C++'s way of doing things (e.g. releasing resources in the C++ destructor rather than a separate finalize method), so it is tough to interface with other langauges that have different object semantics. If you stick to C++ you will have no problems of course.

You might also want to check out GTK, which was developed for UNIX-style systems but has a decent Windows port. It's been used in lots of software so good FAQs are available and the bugs are mostly worked out. GTK was designed with different language bindings in mind, and there are good bindings to at least C++ and Python. There is also a decent RAD tool - Glade.

On the downsides, you'll have to install the GTK DLLs (but then again, cross-platform toolkits without DLL dependencies are rare). Also, while GTK's default visual appearance is nicer than most GUI toolkits, it still doesn't quite have the polished, professional look of native Win32 or QT.

Dan Maas
Monday, December 17, 2001

"Also, while GTK's default visual appearance is nicer than most GUI toolkits, it still doesn't quite have the polished, professional look of native Win32 or QT. "

In fact, one GTK application I installed (Radeon Tweaker) had to have a "legend" on the screen to explain the difference between a checked and an unchecked checkbox.

Johannes Bjerregaard
Monday, December 17, 2001

<< Not to dissuade you from QT at all, but - QT really works best in C++ [..] it is tough to interface with other langauges that have different object semantics.>>

Kylix and Delphi use QT. So that's not entirely true. Borland built a interface layer around QT named CLX. Just like Borland built a layer around the Winapi for Delphi (VCL) making it infinitely easier to talk to Windows while if you want you still can use the Winapi directly.

In Delphi 6 you have the option of using either CLX or VCL components. CLX is used for Linux/Windows cross platform applications. VCL for pure Winapi applications.

JD

Jan Derk
Monday, December 17, 2001

But does Object Pascal actually have different object semantics? I thought it was essentially the same as C++ in that regard - deterministic destruction at end of scope, manual deletion of heap objects, that sort of thing.

Chris Tavares
Monday, December 17, 2001

To clarify my comment about QT interacting with other languages- the problem is that QT follows a "one-owner" memory management model. (e.g. buttons are owned by their parent window, and the window automatically destroys them when it closes). This is problematic to integrate with garbage-collected languages. (you either get dangling references to destroyed QT objects, or you have to somehow invalidate the references manually).

I'm not saying that it's strictly impossible to use QT from a language other than C++; it's just an issue that must be dealt with. Contrast this with GTK, which uses reference counting internally, so it's trivial for the language binding to keep referenced objects alive. (version 2.0 adds weak references)

In order not to sound like a GTK bigot, let me also add two more negatives here =)... GTK does not have a functional native Mac port, whereas QT does. Also, you cannot link statically to GTK and obtain a single executable binary. (it's against the LGPL license... well, you could *theoretically* do this if you also provided a binary object of your program minus linking to GTK - urk).

Dan Maas
Monday, December 17, 2001

Chris Tavares wrote:
"But does Object Pascal actually have different object semantics? I thought it was essentially the same as C++ in that regard"

Yes you are right.

Dan Maas wrote:
"To clarify my comment about QT interacting with other languages- the problem is that QT follows a "one-owner" memory management model. (e.g. buttons are owned by their parent window, and the window automatically destroys them when it closes)."

Yes that's the way Object Pascal works. I should have read your post a little better when you talked about languages with *different* object semantics. Sorry about that.

Jan Derk
Monday, December 17, 2001

Not that I've had a lot of experience, but I'd recomend you at least look at wxWindows.  ( http://www.wxwindows.org )
It's a free (modified LGPL) C++ library with Python and Perl the wraps native function calls, which means that under Windows it looks like a Windows app (because it is), and under *nix it looks like a GTK app (because it is).  It also works for Mac, though that part isn't quite finished yet.  In addition, it has classes for non GUI things like sockets.

Michael Chansky
Monday, December 17, 2001

Does a GUI->XML thing exist out there?

If there is such a standard then perhaps a common denominator that is truly cross-platform is possible.

I apologise if this is a stupid question because I haven't done much GUI development. However, I do agree that Java's GUI is abyssmal, even though it is my main development tool now.

Rex Guo
Saturday, December 22, 2001

Mozilla's GUI is defined in a dialect of XML.  However, its a moving target, no one has abstracted the gui from the rest of the application yet (and likely they'll never be able to).

It is cross platform and some amazing things have been achieved.  It does remind one of dogs, walking and hind legs.

Simon Lucy
Saturday, December 22, 2001

Rex:

From what I hear, Java's Swing components will 'serialize' to XML, which means it can be saved as some XML document.  Makes perfect sense, since it's all trees involved, and any XML too large for the system will correspond to a GUI too large as well...

Straight Java will probably soon be a terrible way to initialize GUIs, with this alternative in JDK 1.4.

Michael Rollins
Saturday, December 22, 2001

Michael:

Thanks for the tip! But now I am curious how compatible/portable is that going to be with things other than Java?

Rex Guo
Saturday, December 22, 2001

Hmm, I doubt it would be the slightest bit portable, but if we're talking theoretically...

The portability would increase the closer a GUI is to having components like Swing's.  For example, a 'JTextField' just is a bunch of attributes (like background color and font) that determine how it looks.  Textfields from other GUIs pretty much look the same way, so it's not hard for them to be represented with the same data.

Hmm, someone definitely must create a GUI language.  An idea whose Time Has Come, if only for the reason that GUIs should be seen as data, and programs should be able to generate them easily.

Michael Rollins
Saturday, December 22, 2001

RAD for wxwindows  http://wxglade.sourceforge.net/

kmilo
Saturday, February 07, 2004

It would be nice to generalise XUL. The XML User Interface Language (XUL) is a markup language for creating rich dynamic user interfaces. It is a part of the Mozilla browser and related applications and is available as part of Gecko.
http://www.xulplanet.com

S. Bray
Wednesday, March 31, 2004

*  Recent Topics

*  Fog Creek Home