Other GUIs

 
   

Ruby Way
By Hal Fulton
Slots : 1.0
Table of Contents
 


As already mentioned, your favorite GUI may not be covered in this chapter. However, we'll use the remaining space in this chapter just to mention some other alternatives.

Many of these alternatives are not fully mature, and one (wxWindows) is completely unavailable to Ruby programmers at this time. However, we expect this list to grow and the supported bindings to become more stable as time goes on.

The (Nongraphical) Curses Environment

In a chapter on graphical interfaces, the venerable curses library might seem to have no place at all. However, there is still a place for curses even today (especially where Telnet is used). It can give you some of the convenience of a graphical interface even in a purely text-based environmenta convenience at least comparable to that of a smart terminal of the late 1970s.

We don't discuss the usage of the curses extension here, but we do want you to be aware of it. It is a part of the standard Ruby distribution for Unix and should run fine on any Unix variant. Microsoft Windows is another matter. There are probably curses and ncurses sources available for MS Windows also, in the event anyone wants to run a curses app on such a platform. However, at this time, this would be a more-or-less "roll your own" solution.

Ruby and X

The X Window System is colloquially (although not correctly) referred to as X Windows. It is perhaps not the grandfather of all GUI systems, but it is certainly the ancestor of many of them.

Unix users of all breeds have long been familiar with X (as users, even if not as developers). Frequently the Motif window manager is run on top of X.

The advantages of X are that it is widely known, very portable, and has a rich feature set. The disadvantages are that it is rather complex and difficult to use.

Not surprisingly, libraries are available for using X with Ruby. We don't document them here because of complexity and lack of space.

We refer you instead to the Ruby Application Archive, where you can find Xlib by Kazuhiro Yoshida (also known as moriq) and Ruby/X11 by Mathieu Bouchard (also known as matju). Either can be used to create X client applications.

Ruby and Qt

The Qt system is well known to many C++ programmers (as well as others). It is a modern graphical systemfull featured and stable. However, in the Windows world, it is currently a commercial product, which has affected its acceptance as a cross-platform solution.

A Ruby/Qt package is available (as of midsummer 2001) in the Ruby Application Archive; it is the work of Nobuyuki Horie. At the present time, it is not yet mature.

Ruby and wxWindows

The wxWindows system is also full featured and stable; it is widely used in the Python world, and there has been some talk of making it the standard or "native" GUI for that language.

As is so often the case, it is more mature on the Unix platforms than in its Windows version. This is expected to change.

At this time, there is no library for writing wxWindows applications in Ruby. There has been talk of creating one (probably with the help of SWIG), but it is sheer vaporware currently. We mention it only for some measure of completeness.

Apollo (Ruby and Delphi)

The true hacker knows that standard Pascal is all but useless. However, there have been many attempts over the years to improve it so that it is a language worth the effort of using. One of the most successful of these is Borland's Object Pascal, used in its RAD tool called Delphi.

The popularity of Delphi is not due to the Pascal language extensions, although these are a contributing factor, but to the development environment itself and the richness of the graphical interface. Delphi has a rich set of widgets for creating stable, attractive GUI applications on MS Windows.

The Apollo library is a marriage of Ruby and Delphi; it is the brainchild of Kazuhiro Yoshida, although others are also working on it. The advantage of Apollo, of course, is that it makes a giant set of stable, usable widgets available; the biggest disadvantage is that it currently requires a slightly "tweaked" version of Ruby. See the Ruby Application Archive for details.

We'll mention one other thing here. Borland (Inprise) has recently released the Kylix development environment for Linux, which is essentially a Linux-based version of Delphi. The plans for Apollo are to interoperate as fully as possible so that applications using it will have basically the same "look and feel" on Linux as on the Microsoft platforms.

Ruby and the Windows API

In Chapter 8, "Scripting and System Administration," we describe a sort of "poor man's GUI" in which we use the WIN32OLE library to get access to the features of Internet Explorer and other such things. Refer to those examples for more details. If you need something quick and dirty, this might be acceptable.

If you are a real glutton for punishment, you could access the Windows API directly. The WIN32API library (also discussed in Chapter 8) makes this kind of coding possible. We don't necessarily recommend the practice, but we want you to be aware of this capability.


   

 

 



The Ruby Way
The Ruby Way, Second Edition: Solutions and Techniques in Ruby Programming (2nd Edition)
ISBN: 0672328844
EAN: 2147483647
Year: 2000
Pages: 119
Authors: Hal Fulton

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net