Paul Carvalho
2010-Mar-22 22:12 UTC
[fxruby-users] Quitting Extended app via button produces errors
Hi there, I used foxGUIb to create a UI and a separate file to hold the event actions. When I try to quit the app (see source code below) using a [Quit] button, I get the following error: ----->rubyw extended_quit.rbextended_quit.rb:5:in `init'': uninitialized constant MainWindow::FXApp (NameError) from c:/ruby/lib/ruby/gems/1.8/gems/fxruby-1.6.12-mswin32/lib/fox16/responder2.rb:55:in `call'' from c:/ruby/lib/ruby/gems/1.8/gems/fxruby-1.6.12-mswin32/lib/fox16/responder2.rb:55:in `onHandleMsg'' from extended_quit.rb:15:in `run'' from extended_quit.rb:15>Exit code: 1----- => Question: How do I get the app to quit/exit without showing this error? When I work with a straight FXRuby app (e.g. hello.rb), the app exits without any error. I have tried several ways to try to get the app to quit, and while the error message may change, I can''t get the error message to go away and just exit cleanly (0). Please let me know. Thanks. Paul. Here is the code: (1) extended_quit.rb: ----- require "quit_ui" class MainWindow def init button1.connect(Fox::SEL_COMMAND){ FXApp::ID_QUIT } end # of events end if __FILE__==$0 require ''libGUIb16'' app=FX::App.new w=MainWindow.new app w.topwin.show(Fox::PLACEMENT_SCREEN) app.create app.run end ----- (2) quit_ui.rb: ----- # source generated by foxGUIb 1.0.0 class MainWindow def initialize( parent) construct_widget_tree( parent) init if respond_to? ''init'' end def construct_widget_tree( parent) @topwin FX::MainWindow.new(parent){|w| @mainWindow=w w.wdg_name=''mainWindow'' w.width=300 w.shown=true w.y=233 w.height=100 w.x=55 FX::Button.new(@mainWindow){|w| @button1=w w.wdg_name=''button1'' w.text="Quit" w.width=50 w.height=30 } } end attr_reader :topwin attr_reader :mainWindow attr_reader :button1 end ----- -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/fxruby-users/attachments/20100322/7354a774/attachment.html>
dave L
2010-Mar-24 08:49 UTC
[fxruby-users] Quitting Extended app via button produces errors
Paul,
Just loaded this into my Linux box (hope this works for your winXP - should i
think)
I got caught and still do sometimes event now but have learn to look for my
errors.
I suspect if you where to simply change these 2 lines (hope the highlights come
through to something like
I have then you should be running.
require "events_ui" <<<<<< changed the filename of
the GUIb code ergo this is changed here!!!
class AmainWindow < MainWindow <<<<<< see the changes made
here???
def init
button1.connect(Fox::SEL_COMMAND){ FXApp::ID_QUIT }
end # of events
end
if __FILE__==$0
require ''libGUIb16''
app=FX::App.new
w=AmainWindow.new app <<<< see changes made here
w.topwin.show(Fox::PLACEMENT_SCREEN)
app.create
app.run
end
HTH
Dave.
________________________________
From: Paul Carvalho <tester.paul at gmail.com>
To: fxruby-users at rubyforge.org
Sent: Tue, 23 March, 2010 11:12:22 AM
Subject: [fxruby-users] Quitting Extended app via button produces errors
Hi there, I used foxGUIb to create a UI and a separate file to hold the event
actions.
When I try to quit the app (see source code below) using a [Quit] button, I get
the following error:
----->rubyw extended_quit.rb
extended_quit.rb:5:in `init'': uninitialized constant MainWindow::FXApp
(NameError)
from
c:/ruby/lib/ruby/gems/1.8/gems/fxruby-1.6.12-mswin32/lib/fox16/responder2.rb:55:in
`call''
from
c:/ruby/lib/ruby/gems/1.8/gems/fxruby-1.6.12-mswin32/lib/fox16/responder2.rb:55:in
`onHandleMsg''
from extended_quit.rb:15:in `run''
from extended_quit.rb:15>Exit code: 1
-----
=> Question: How do I get the app to quit/exit without showing this error?
When I work with a straight FXRuby app (e.g. hello.rb), the app exits without
any error. I have tried several ways to try to get the app to quit, and while
the error message may change, I can''t get the error message to go away
and just exit cleanly (0).
Please let me know. Thanks. Paul.
Here is the code:
(1) extended_quit.rb:
-----
require "quit_ui"
class MainWindow
def init
button1.connect(Fox::SEL_COMMAND){ FXApp::ID_QUIT }
end # of events
end
if __FILE__==$0
require ''libGUIb16''
app=FX::App.new
w=MainWindow.new app
w.topwin.show(Fox::PLACEMENT_SCREEN)
app.create
app.run
end
-----
(2) quit_ui.rb:
-----
# source generated by foxGUIb 1.0.0
class MainWindow
def initialize( parent)
construct_widget_tree( parent)
init if respond_to? ''init''
end
def construct_widget_tree( parent)
@topwin FX::MainWindow.new(parent){|w|
@mainWindow=w
w.wdg_name=''mainWindow''
w.width=300
w.shown=true
w.y=233
w.height=100
w.x=55
FX::Button.new(@mainWindow){|w|
@button1=w
w.wdg_name=''button1''
w.text="Quit"
w.width=50
w.height=30
}
}
end
attr_reader :topwin
attr_reader :mainWindow
attr_reader :button1
end
-----
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://rubyforge.org/pipermail/fxruby-users/attachments/20100324/382b1a2b/attachment.html>