FXRuby: how to capture a function key?

i use ruby 1.6.7, fox 1.0.18 , FXRuby 1.0.12.
all compile on cygwin ( on windows xp).

on Tk , i can use widget.bind(‘key-F1’,proc{…}) to capture key
and execute code

now , i try to use FXRuby instead, but i don’t know
how to capture function key and execute code?

somphong s.

somphong s. wrote:

i use ruby 1.6.7, fox 1.0.18 , FXRuby 1.0.12.
all compile on cygwin ( on windows xp).

on Tk , i can use widget.bind(‘key-F1’,proc{…}) to capture key
and execute code

now , i try to use FXRuby instead, but i don’t know
how to capture function key and execute code?

somphong s.

Try:

widget.connect(SEL_KEYPRESS) do |sender, sel, event|
  if event.code == KEY_F1
    # do something
  end
end

Hope this helps,

Lyle