foxGUIb

GUI Creator for Ruby + Fox

Guide Contents

Advanced Points

If It Crashes...

There are some bugs, if it crashes, it saves a *_failsave.rbin file when crashing, so you won't lose your work.

The Ruby Console

The ruby console evaluates Ruby code. The results can be printed to the console by using the function "out". It is mainly for debugging but can also be used by users to try out things that foxGUIb doesn't allow/support:

Example - filling a list:

Add a List to your layout and select it. you can access the selected widget via the global variable $__wdg__


> out $__wdg__
#
> $__wdg__.fillItems ["foo", "bar", "baz"]
will add entries to the list. foxGUIb (currently) does not directly support the adding of entries via the properties window.

Another example - setting properties for a complete widget tree:


> $__wdg__.recursive{|w| w.backColor=FXRGB(180,180,180) if w.respond_to? :backColor}
changes the backColor of the selected widget and all its children recursively.

the method :recursive is an extension to Fox::FXWindow provided by libGUIb. see libGUIb API

Note that the above code is for design-time experimentation - the changes to the GUI design are not saved in the rbin file.

Event editor and return value - advanced note

The return value of the event-handling code (either 0 or 1) lets you control whether the built in event-handling code of the widget gets executed or not. (see the event_handler.rb example in the /fox-tool/foxGUIb/examples directory of the foxGUIb download.)

A return value of 0 at the end of the block tells fox to execute the built-in event-handling for this event after the user's code. A return value of 1 blocks the built in handling (using this you can completely replace a widget's behaviour).

 


Guide Contents