[fxruby-users] addAccel

Philippe Lang philippe.lang at attiksystem.ch
Sun Jan 21 17:53:03 EST 2007


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


More information about the fxruby-users mailing list