From: Lyle Johnson Date: 2003-03-25T09:40:58+09:00 Subject: Re: [FXRuby] How to capture key events Hans Fugal wrote: > I have a simple gui that consists of mostly just a FXText object, and I > would like to react to keys pressed such as q or space. I am fairly new > to Fox, and haven't been able to glean the answer from any of the Fox or > FXRuby docs online. For most widgets, you can intercept the SEL_KEYPRESS and SEL_KEYRELEASE messages when a key goes down (or up): aWindow.connect(SEL_KEYPRESS) do |sender, sel, event| if event.code == KEY_q puts "q key was pressed" end end aWindow.connect(SEL_KEYRELEASE) do |sender, sel, event| if event.code == KEY_q puts "q key was released" end end Hope this helps, Lyle