24.11.08

GUI toolkit extravaganza part II: FXRuby

The FXRuby toolkit is the subject of the GUI toolkit extravaganza, part deux. In this 7 part series, we will take a look at the various GUI toolkits in existence to find the ultimate GUI toolkit. One of the best known GUI toolkits is FXRuby, wich we will look at in this post.

FXRuby
FXRuby is a library that enables Ruby code to use the Fox toolkit. Fox is a graphics toolkit which was written in C++ and known for it's speed. FXRuby was created way back in 2001 and one of it's aims is to provide a cross-platform Ruby GUI toolkit. Let's take a closer look!

ease of installation
FXRuby has an interactive installer for Windows systems. Macintosh systems can use the Mac ports. The sources are available so you can compile from source in any case. I had a bit of trouble installing it on my Ubuntu Hardy Heron system. But eventually I got it working. Here's what you need to do:
apt-get install libfox-1.6-0 libfox-1.6-dev libfox-1.6-doc
gem install fxruby

documentation
FXRuby has been nicely documented. The project website provides the complete API reference and a users guide.

There is also a book written solely about FXRuby. The project's website hosts two mailinglists as well.

supported platforms
FXRuby has been created to provide a cross platform GUI toolkit, so it runs on multiple platforms. Systems running Linux, UNIX, Windows or Os/X are all supported by FXRuby.

complexity
Take a look at the following code sample. We create a main window and place a button on it. We use PLACEMENT_SCREEN to center it. Piece of cake!

#!/usr/bin/env ruby
require 'fox16'
include Fox
app = FXApp.new
MainWindow = FXMainWindow.new(app, "FXwindow" ,
:width => 200, :height => 100)
FXButton.new(MainWindow,"Button",nil,nil,0,BUTTON_NORMAL|LAYOUT_CENTER_Y|LAYOUT_CENTER_X)
app.create
MainWindow.show(PLACEMENT_SCREEN)
app.run

functionality
FXRuby provides a standard set of graphical functions. But one feature that makes it stand out on the feature front is the support for OpenGL, providing the posibility to render cool 3-D graphics from your Ruby code.

performance
The Fox toolkit is known for it's speed and limited use of system recourses. From what I have seen, the same goes for FXRuby, it is light and it is fast.

looks
There's not much difference to be seen in the example provided here and the one previously provided in parts I of the GUI toolkit extravaganza. There are some minimal details around the buttons and edges.



Update: ok, this does not help a lot. Here's an impression of one of the sample programs that come with Fxruby:
As you can see, it looks a bit like some apps did in the windows98 days...

You can find the FXRuby toolkit at:


Stay tuned for the GUI toolkit extravaganza part III: WxRuby

No comments: