[fxruby-users] Quitting Extended app via button produces errors

Paul Carvalho tester.paul at gmail.com
Mon Mar 22 18:12:22 EDT 2010


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/20100322/7354a774/attachment.html>


More information about the fxruby-users mailing list