[fxruby-users] key event capturing - help

dave L dglnz at yahoo.com
Sat Oct 16 05:22:35 EDT 2010

I am using foxGUIb for the gui front end (I don't believe this is where my issue 
is) but i cannot get a couple of things right.

How do I use the keys.rb file within my project?
Currently I am doing a require 'keys' and then including it.

this then allows me to access constant variables like KEY_Return etc.

I am using within my event handler this type of code....


  if KEY_Return.to_s == <what do i put in here?>

I've tried...
        event.state (this gives me 16, 17 for shift, 20 for Ctrl, 24 for Alt, 16 
for backspace & tab & delete & insert so it's not the best).
        a.to_s and this to be compared to the Key_Return.to_s value but this 
fails too.

After having a read of lyle's PDF I found that there is another method I hadn't 
known about call code using this gives me a match to the KEY_Return constant 
that I was looking for!!

So now I have this....


  if KEY_Return.to_s == event.code.to_s
      statements in here WILL be actioned ONLY when the keyboard enter key IS 

Hope this may help someone down the track.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/fxruby-users/attachments/20101016/ff838f91/attachment-0001.html>

More information about the fxruby-users mailing list