[fxruby-users] foxGUIb GUI and code separation question

dave L dglnz at yahoo.com
Fri Mar 12 01:38:22 EST 2010

Hi Paul,

I too use foxGUIb.

Mienrad (Henon) has help me lots with a project I've been working no in the last year and I intend to do some screen casts to showcase problems I've been working on over the past year and how to to correct them.

the first thing you need to look at is this bit of code (text taken from the site you mentioned) with comments added by me.

require "InchesX"  # this being the foxGUIb generated source file - the .rb file.

#    here you need to subclass the foxGUIb generated code
#    So if you called you generated code inches.rb then change the class line to
#        class InchesX < inches.
#    Of course you will also need to have a require above this SO...
#    on 1st line you'll have require 'inches.rb' - the .rb may not be needed!!
# this is the 1st thing - subclassing YOU'RE event handling code from the GUI code.
class InchesX
    def init
# each of the control names MUST be found in the GUIb generated source!
         	cmLabel.text=(inchesField.text.to_f * 2.54 ).to_s

    end   # of events

#unit test
if __FILE__==$0
	require 'FX'
# This line was something that got me good!
# ALWAYS REMEMBER if cutting and pasting to change this
# line below to the class name of your event handling code - I ALWAY FORGOT
# until after a few programs!
	w=InchesX.new app    

Hope this helps, Google for foxGUIb and you'll see a lot of posting from me regarding issues I've had and i hope will help you with problems you may face and from googling learn from my mistakes 


ps Paul i have sent a private email to you with a sample program that works to help you see things hope fully better.

From: Paul Carvalho <tester.paul at gmail.com>
To: fxruby-users at rubyforge.org
Sent: Fri, 12 March, 2010 5:19:44 PM
Subject: [fxruby-users] foxGUIb GUI and code separation question

Hi there, I created the sample program from the foxGUIb guide and it worked okay.

Then I tried the example where the GUI and code are separated (i.e. see http://www.mikeparr.info/rubyguib/firstprog.htm ) but I can't get it to work.

When I run the ExtendInches.rb script (exact code on the above page), I get the following error:
>rubyw ExtendInches.rb
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require': no such file to load -- FX (LoadError)
    from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
    from ExtendInches.rb:15
>Exit code: 1

What am I missing?

I tried changing the "#unit test" code to match the code from the InchesX.rb script but then I get a different error - still doesn't work.

Please help.  TIA.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/fxruby-users/attachments/20100311/a0af958a/attachment.html>

More information about the fxruby-users mailing list