Section 12.6. Conclusion


12.5. Other GUI Toolkits

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

Some of these alternatives are not fully mature and may be buggy or incomplete. However, we expect this list to grow and the supported bindings to become more stable as time goes on.

12.5.1. Ruby and X

The X Window System is colloquially (though 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, portable, and has a rich feature set. The disadvantages are that it is complex and difficult to use.

Not surprisingly, there are libraries for using X with Ruby. They aren't documented here because of their complexity.

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.

12.5.2. Ruby and wxWidgets

The wxWidgets system (formerly wxWindows) is full-featured and stable; it is widely used in the Python world, virtually the native GUI for that language. The philosophy behind the toolkit in general is to use the native OS widgets as much as possible. It is somewhat more mature on the UNIX platforms than in its Windows version, but this is changing daily, of course.

At this time, there is a reasonably mature wxRuby library. If this is your toolkit of choice, go to http://wxruby.rubyforge.org/ for documentation and downloads.

12.5.3. 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 could be 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, though 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. It should interoperate with Borland's "classic" software Kylix, which is essentially a Linux-based Delphi. See the Ruby Application Archive for more details.

12.5.4. Ruby and the Windows API

In Chapter 8, "Arrays, Hashes, and Other Enumerables," 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 14, "Scripting and System Administration") makes this kind of coding possible. I don't necessarily recommend the practice, but you should be aware of the possibility.




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

Similar book on Amazon

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