background preloader

FXRuby

Facebook Twitter

FXRuby: Ruby Study Notes - Best Ruby Guide, Ruby Tutorial. FXRuby is a library for developing graphical user interfaces (GUIs) for your Ruby application.

FXRuby: Ruby Study Notes - Best Ruby Guide, Ruby Tutorial

It's based on the FOX toolkit, a popular open source C++ library. FXRuby exposes all the functionality of the FOX library. FOX and FXRuby are both licensed under LGPL which permits the use of those libraries in both free and proprietary (commercial) software applications. This brief article introduces FXRuby to the POARPC101 participants and is based on the various articles and tutorials on the FXRuby site. Installing FXRuby For installing on Windows, open a command window and type: Please refer the FXRuby site for installing FXRuby on other operating systems. The Basics We will put together some basic code to display a "Welcome FORPC101" window. Since all of the FXRuby classes are defined under the Fox module, you'd normally need to refer to them using their "fully qualified" names (i.e. names that begin with the Fox:: prefix). An Introduction to FXRuby. FXRuby is a powerful library for developing cross-platform graphical user interfaces (GUIs).

An Introduction to FXRuby

It is based on the FOX toolkit (an open source, highly optimized library written in C++) and offers Ruby developers the possibility of coding applications in the language they love, whilst at the same time taking advantage of FOX’s underlying performance and functionality. In this article, I’m going to show you how to get up and running with FXRuby, introduce you to some of the more commonly used widgets, and demonstrate how to build a simple application with some real world value. The code from this tutorial is available from our GitHub repo. Installation Presuming you have Ruby 1.9 installed on your machine. Windows 7: gem install fxruby Ubuntu 12.04: sudo apt-get install ruby1.9.1-dev g++ libxrandr-dev libfox-1.6-devsudo gem install fxruby Mac OS X: sudo gem install fxruby If you run into any trouble, more detailed instructions can be found here: Hello, World! Let’s examine what the above code is doing: FXRuby. Chapter 3. Hello, World! There are a few things common to all programs that use FXRuby, and the purpose of this chapter is to help you get familiar with those.

Chapter 3. Hello, World!

We'll do this by developing a short program that simply displays a button containing the text, "Hello, World! ". For reference, this program is included in the examples subdirectory of the standard FXRuby source code distribution. All of the code associated with the FXRuby extension is provided by the fox16 gem, so we need to start by requiring this gem: require 'fox16' Since all of the FXRuby classes are defined under the Fox module, you'd normally need to refer to them using their "fully qualified" names (i.e. names that begin with the Fox:: prefix).

Require 'fox16' include Fox Every FXRuby program begins by creating an FXApp instance: require 'fox16' include Fox theApp = FXApp.new The FXApp instance has a lot of responsibilities in an FXRuby application. The next step is to create an FXMainWindow instance to serve as the application's main window. Documentation for fxruby (1.6.33)

FXRuby is a library for developing powerful and sophisticated cross-platform graphical user interfaces (GUIs) for your Ruby applications.

Documentation for fxruby (1.6.33)

It’s based on the FOX Toolkit, a popular open source C++ library developed by Jeroen van der Zijp. What that means for you as an application developer is that you’re able to write code in the Ruby programming language that you already know and love, while at the same time taking advantage of the performance and functionality of a featureful, highly optimized C++ toolkit. FXRuby supportes everything of FOX, that is useful in Ruby: MDI/SDI application window layouts, floating toolbarsRich set of controls (tables, imagelists, menus, canvas, …)Flexible layout managementImage read/write support in many formatsEmbedded OpenGL graphicsThread support FXRuby runs on Linux, Windows and OS-X with Ruby-1.9.3 or newer and with Rubinius.

Then, install the gem: