Paul Carvalho
2010-Mar-12 04:19 UTC
[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.rbc:/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/98d79351/attachment.html>
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 #events def init # each of the control names MUST be found in the GUIb generated source! convertButton.connect(SEL_COMMAND){ cmLabel.text=(inchesField.text.to_f * 2.54 ).to_s } end # of events end #unit test if __FILE__==$0 require ''FX'' app=App.new # 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 w.topwin.show(0) app.create app.run end 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 HTH 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.rbc:/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>
Paul Carvalho
2010-Mar-12 16:04 UTC
[fxruby-users] foxGUIb GUI and code separation question
Hello Dave, thank you for your reply. The sample code you sent in your private reply helped me fix the code to make it work. Here''s a summary of what I tried and did until I got it to work: 1) original code from the web site didn''t work. - when I ran it, I get the error: "no such file to load -- FX (LoadError)" => The problem seems to be with the "require ''FX''" line - I noticed in your sample program you included the same lines from your GUI script, so I changed the following lines from: require ''FX'' app=App.new to: require ''libGUIb16'' app=FX::App.new -> And now I don''t get the "cannot load file" error. 2) File loads, code still doesn''t work. Now when I run the ExtendsInches.rb script, I get the following error: ---->rubyw ExtendInches.rbExtendInches.rb:6:in `init'': uninitialized constant InchesX::SEL_COMMAND (NameError) from ./InchesX.rb:6:in `initialize'' from ExtendInches.rb:19:in `new'' from ExtendInches.rb:19>Exit code: 1---- -> This is where the sample code you sent in your follow-up reply really helped me. I changed the following line from: convertButton.connect(SEL_COMMAND){ to: convertButton.connect(Fox::SEL_COMMAND){ -> and now the script works!!! =) Someone should probably update the code in the foxGUIb guide. This was very frustrating to try and figure out. Thanks for your help! Cheers! Paul. On 12 March 2010 01:38, dave L wrote:> 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. > > [snip]> 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 > > HTH > > ps Paul i have sent a private email to you with a sample program that works > to help you see things hope fully better. >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/fxruby-users/attachments/20100312/2da28447/attachment.html>
Meinrad Recheis
2010-Mar-12 17:58 UTC
[fxruby-users] foxGUIb GUI and code separation question
Hi Paul, Thanks for giving detailed feedback about the errors in the guide. I notified the author and forwarded your mail to him. Best wishes, -- henon On Fri, Mar 12, 2010 at 5:04 PM, Paul Carvalho <tester.paul at gmail.com>wrote:> Hello Dave, thank you for your reply. The sample code you sent in your > private reply helped me fix the code to make it work. > > Here''s a summary of what I tried and did until I got it to work: > > 1) original code from the web site didn''t work. > - when I ran it, I get the error: "no such file to load -- FX (LoadError)" > > => The problem seems to be with the "require ''FX''" line > > - I noticed in your sample program you included the same lines from your > GUI script, so I changed the following lines from: > > > require ''FX'' > app=App.new > > to: > require ''libGUIb16'' > app=FX::App.new > > -> And now I don''t get the "cannot load file" error. > > 2) File loads, code still doesn''t work. Now when I run the > ExtendsInches.rb script, I get the following error: > ---- > >rubyw ExtendInches.rb > ExtendInches.rb:6:in `init'': uninitialized constant InchesX::SEL_COMMAND > (NameError) > from ./InchesX.rb:6:in `initialize'' > from ExtendInches.rb:19:in `new'' > from ExtendInches.rb:19 > >Exit code: 1 > ---- > > -> This is where the sample code you sent in your follow-up reply really > helped me. > I changed the following line from: > > convertButton.connect(SEL_COMMAND){ > > to: > convertButton.connect(Fox::SEL_COMMAND){ > > -> and now the script works!!! =) > > Someone should probably update the code in the foxGUIb guide. This was > very frustrating to try and figure out. > > Thanks for your help! Cheers! Paul. > > > On 12 March 2010 01:38, dave L wrote: > >> 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. >> >> [snip] > >> 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 >> >> HTH >> >> ps Paul i have sent a private email to you with a sample program that >> works to help you see things hope fully better. >> > > > _______________________________________________ > fxruby-users mailing list > fxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/fxruby-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/fxruby-users/attachments/20100312/46ec8854/attachment-0001.html>
Should have seen the error myself. Well you can see why i have so many posts floating around the web As I''ve said I intended to at sometime post a screen cast showing things like that which are gotchas for people new to fxruby and have found and like the foxGUIb. If i can help please holler, but also post on the list as others may also help and faster than I. cheers, Glad what i did has helped you. ________________________________ From: Paul Carvalho <tester.paul at gmail.com> To: fxruby-users at rubyforge.org Sent: Sat, 13 March, 2010 5:04:13 AM Subject: Re: [fxruby-users] foxGUIb GUI and code separation question Hello Dave, thank you for your reply. The sample code you sent in your private reply helped me fix the code to make it work. Here''s a summary of what I tried and did until I got it to work: 1) original code from the web site didn''t work. - when I ran it, I get the error: "no such file to load -- FX (LoadError)" => The problem seems to be with the "require ''FX''" line - I noticed in your sample program you included the same lines from your GUI script, so I changed the following lines from: require ''FX'' app=App.new to: require ''libGUIb16'' app=FX::App.new -> And now I don''t get the "cannot load file" error. 2) File loads, code still doesn''t work. Now when I run the ExtendsInches.rb script, I get the following error: ---->rubyw ExtendInches.rbExtendInches.rb:6:in `init'': uninitialized constant InchesX::SEL_COMMAND (NameError) from ./InchesX.rb:6:in `initialize'' from ExtendInches.rb:19:in `new'' from ExtendInches.rb:19>Exit code: 1---- -> This is where the sample code you sent in your follow-up reply really helped me. I changed the following line from: convertButton.connect(SEL_COMMAND){ to: convertButton.connect(Fox::SEL_COMMAND){ -> and now the script works!!! =) Someone should probably update the code in the foxGUIb guide. This was very frustrating to try and figure out. Thanks for your help! Cheers! Paul. On 12 March 2010 01:38, dave L wrote: 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. > >[snip] 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 > >HTH > >ps Paul i have sent a private email to you with a sample program that works to help you see things hope fully better. >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/fxruby-users/attachments/20100312/9120d82f/attachment.html>