On Thu, 28 Jun 2001 09:23:13 -0500, "Lyle Johnson" <ljohnson / resgen.com> wrote: >Message handlers (like your "onKeyPress" method) need to be registered with >FOX so that it knows to call them. > > class MyTextField < FXTextField > def initialize(p, ncols, tgt, sel, opts) > # Be sure to call the base class constructor! > super(p, ncols, tgt, sel, opts) > > # Map the SEL_KEYPRESS message to the onKeyPress instance method > FXMAPFUNC(SEL_KEYPRESS, 0, "onKeyPress") > end > > def onKeyPress(sender, sel, ptr) > ... whatever ... > end > end I've tried this but it doesn't work as expected: ----snip---- require "fox" require "responder" include Fox class MyTextField < FXTextField include Responder def initialize(p, ncols, tgt, sel, opts) super(p, ncols, tgt, sel, opts) FXMAPFUNC(SEL_KEYPRESS, 0, "onKeyPress") end def onKeyPress(sender, sel, ptr) super(sender, sel, ptr) p "called" end end class MyMainWindow < FXMainWindow include Responder def initialize(app) super(app, "MyTextField Test", nil, nil, DECOR_ALL) @mytext = MyTextField.new(self, 30, nil, 0, LAYOUT_CENTER_Y|FRAME_SUNKEN|FRAME_THICK) end def create super show(PLACEMENT_SCREEN) end end def run application = FXApp.new("MyTextField", "FoxTest") application.init(ARGV) window = MyMainWindow.new(application) application.create application.run end run ---- snip ---- Results in: X:\Home\Lang\Ruby\myinput.rb:35:in `onKeyPress': Expected void * (TypeError) from X:\Home\Lang\Ruby\myinput.rb:35:in `run' from X:\Home\Lang\Ruby\myinput.rb:35:in `run' from X:\Home\Lang\Ruby\myinput.rb:38 as soon as I press a key. Any clues? Sincerely Ralf