I have recently started to use wxRuby, because I have used the wxWidgets
library from C++ for a few years and found it an excellent toolkit. I
am
using Ubuntu 8.04 and version 1.9.6 of wxRuby.
A problem though is a number of instabilities. This may be due to my
own
ignorance, but I have usually found C++/wxWidgets, once the program
compiles
it will at least stay working, if at times incorrectly. With wxRuby,
the
program sometimes just crashes out, or the event handler appears to
freeze.
The code below reproduces one problem. After opening one or two child
frames and then closing one of them, the program soon fails. I find
that
the frames stop receiving events, don’t redraw themselves when covered,
etc. Sometimes this happens very quickly, sometimes after a minute or
so.
Is this a bug, or should I be doing something different to show/hide
child
frames?
Thanks for any help with this.
Peter.
class ChildFrame < Wx::Frame
def initialize parent
super(parent, -1, “Child frame”)
viewMenu = Wx::Menu.new
viewMenu.append(Wx::ID_CLOSE, "Close\tCtrl-W", "Close this window")
evt_menu(Wx::ID_CLOSE) { show false }
menuBar = Wx::MenuBar.new
menuBar.append(viewMenu, "&View")
set_menu_bar menuBar
end
end
class TestFrame < Wx::Frame
def initialize
super(nil, -1, “Test Frame”)
menu = Wx::Menu.new
menuItem = Wx::MenuItem.new(menu, -1, "Show child")
menu.append_item menuItem
evt_menu(menuItem) { ChildFrame.new(self).show }
menuBar = Wx::MenuBar.new
menuBar.append(menu, "&View")
set_menu_bar menuBar
end
end
class TestApp < Wx::App
def on_init
TestFrame.new.show
end
end
TestApp.new.main_loop