[fxruby-users] key event capturing - help

dave L dglnz at yahoo.com
Wed Oct 20 02:07:04 EDT 2010


Thank - you Phillipe,

After some scratching around and read Lyle's PDF again I found reference to this 
and so that has been sorted :).

and yes again I'm using the SEL_KEYRELEASE.
many thanks for you're time and assistance.

Dave





________________________________
From: Philippe Lang <philippe.lang at attiksystem.ch>
To: "fxruby-users at rubyforge.org" <fxruby-users at rubyforge.org>
Sent: Mon, 18 October, 2010 8:12:33 PM
Subject: Re: [fxruby-users] key event capturing - help

> De : fxruby-users-bounces at rubyforge.org [mailto:fxruby-users-
> bounces at rubyforge.org] De la part de dave L
> Envoyé : samedi 16 octobre 2010 11:23
> À : fxruby
> Objet : [fxruby-users] key event capturing - help
> 
> 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.
> 
> 1st
> 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.
> 
> 2nd
> I am using within my event handler this type of code....
> 
> @textfield1.connect(Fox::SEL_KEYPRESS){|a,b,event|
> 
>   if KEY_Return.to_s == <what do i put in here?>
>       statements
>   end
> }

Hi,

You can use event.code, like this:

def onKeyPress(sender, sel, data)
   if data.code == KEY_Tab
end

> So now I have this....
> 
> 
> @textfield1.connect(Fox::SEL_KEYPRESS){|a,b,event|
> 
>   if KEY_Return.to_s == event.code.to_s
>       statements in here WILL be actioned ONLY when the keyboard enter
> key IS pressed!!
>   end
> }

OK, then in this case you have to use another event: SEL_KEYRELEASE

Best regards,

-------------------------------------------------------------
Attik System              web  : http://www.attiksystem.ch
Philippe Lang             phone: +41 26 422 13 75
rte de la Fonderie 2      gsm  : +41 79 351 49 94
1700 Fribourg             pgp  : http://keyserver.pgp.com 


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/fxruby-users/attachments/20101019/29aa9d04/attachment.html>


More information about the fxruby-users mailing list