Hi,
I''m trying to add keyboard accelerators in my app, without success.
Does
anyone see the problem in the following code?
I always get a segmentation fault when I hit Ctrl-S:
C:/test/accell.rb:35: [BUG] Segmentation fault
ruby 1.8.5 (2006-08-25) [i386-mswin32]
Thanks!
-------------------------
require ''fox16''
include Fox
class MyWindow < FXMainWindow
include Responder
ID_SAVE = FXMainWindow::ID_LAST
def initialize(app)
super(app, "Window", nil, nil, DECOR_ALL, 0, 0, 200, 100)
FXMAPFUNC(SEL_COMMAND, MyWindow::ID_SAVE, ''onSave'')
accelTable.addAccel(fxparseAccel("Ctrl-S"), self,
FXSEL(SEL_COMMAND,
MyWindow::ID_SAVE))
end
def onSave(sender, selector, data)
puts "save"
end
def create
super
show(PLACEMENT_SCREEN)
end
end
if __FILE__ == $0
application = FXApp.new("Fox", "FXRuby Test")
MyWindow.new(application)
application.create
application.run
End
-------------------------
I''m using FXRuby 1.6.5 / Ruby 1.8.5 under XP.
Philippe
On Jan 21, 2007, at 4:53 PM, Philippe Lang wrote:> I''m trying to add keyboard accelerators in my app, without success. > Does > anyone see the problem in the following code?It''s working OK under Mac OS X, although it does print out an assert message before it prints "save": pepper:~/src/FXRuby-1.6/examples lyle$ ruby p.rb FXRuby.cpp:880: FXASSERT(FALSE) failed. save I will try it out under Windows in a while and see what happens. That assert failure may have a (crashy) side effect on Windows that doesn''t show up under Mac OS X.
Philippe Lang wrote:> Hi, > > I''m trying to add keyboard accelerators in my app, without success. Does > anyone see the problem in the following code? > > I always get a segmentation fault when I hit Ctrl-S:<snip code> I get that too on windows; ruby-1.8.5, fxruby-1.6.5. -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407