List Info

Thread: Pointer position on keypress event?




Pointer position on keypress event?
user name
2006-04-07 09:28:39
Hi.

Is there any straightforward way to tell pointer position
(x, y)
upon keypress? In original wxWidgets, wxKeyEvent supports
GetX()
and GetY() methods, but wxRuby's KeyEvent object does not
have
one. I also checked with event.methods and
event.instance_variables.

Do I need to keep track of pointer position by evt_motion?

--
Taisuke Yamada <tyamadajpspam.rakugaki.org>, http://rakugaki.org/
2268 E9A2 D4F9 014E F11D  1DF7 DCA3 83BC 78E5 CD3A

Message to my public address may not be handled in a timely
manner.
For a direct contact, please use my private address on my
namecard.

_______________________________________________
wxruby-users mailing list
wxruby-usersrubyforge.org
ht
tp://rubyforge.org/mailman/listinfo/wxruby-users
Pointer position on keypress event?
user name
2006-04-09 09:59:43
Hi

Are you using wxruby 0.6.0 or wxruby2? I know several event
classes are 
missing in wxruby 0.6.0 which isn't being developed. The
event handler 
is fired correctly, but a generic WxEvent is returned which
doesn't have 
all the expected methods.

I have just tried evt_key_down in wxruby2 which is currently
being 
developed. The KeyEvent has the get_x(), get_y() and
get_position() methods.

However, the value of get_x and get_y seems to be always 0.
This may be 
a bug - perhaps someone else could try and confirm, and then
we can work 
on a fix. Do you have a short sample we could see please?

cheers
alex


> Is there any straightforward way to tell pointer
position (x, y)
> upon keypress?
> In original wxWidgets, wxKeyEvent supports GetX()
> and GetY() methods, but wxRuby's KeyEvent object does
not have
> one. I also checked with event.methods and
event.instance_variables.
>
> Do I need to keep track of pointer position by
evt_motion?
>
> --
> Taisuke Yamada <tyamadajpspam.rakugaki.org>, http://rakugaki.org/
> 2268 E9A2 D4F9 014E F11D  1DF7 DCA3 83BC 78E5 CD3A
>
> Message to my public address may not be handled in a
timely manner.
> For a direct contact, please use my private address on
my namecard.
>
> _______________________________________________
> wxruby-users mailing list
> wxruby-usersrubyforge.org
> ht
tp://rubyforge.org/mailman/listinfo/wxruby-users
>
>
>   

_______________________________________________
wxruby-users mailing list
wxruby-usersrubyforge.org
ht
tp://rubyforge.org/mailman/listinfo/wxruby-users
Pointer position on keypress event?
user name
2006-04-11 01:48:33
I'm using wxruby 0.6.0 (binary package downloaded from
sourceforge).
Attached is a sample script, but I can confirm 0.6.0 does
not
have get_x/get_y methods nor equivalent instance variables.

Guess it's time for wxruby2?
Is there any compiled package available?

BTW, I tested similar code on C++ wxWidgets, and wxKeyEvent
did
return proper pointer location with GetX()/GetY(). So
wxruby2
seems to have its own issue.

> Are you using wxruby 0.6.0 or wxruby2? I know several
event classes are 
> missing in wxruby 0.6.0 which isn't being developed.
The event handler 
> is fired correctly, but a generic WxEvent is returned
which doesn't have 
> all the expected methods.
> 
> I have just tried evt_key_down in wxruby2 which is
currently being 
> developed. The KeyEvent has the get_x(), get_y() and
get_position() methods.
> 
> However, the value of get_x and get_y seems to be
always 0. This may be 
> a bug - perhaps someone else could try and confirm, and
then we can work 
> on a fix. Do you have a short sample we could see
please?
> 
>> Is there any straightforward way to tell pointer
position (x, y)
>> upon keypress?
>> In original wxWidgets, wxKeyEvent supports GetX()
>> and GetY() methods, but wxRuby's KeyEvent object
does not have
>> one. I also checked with event.methods and
event.instance_variables.
>>
>> Do I need to keep track of pointer position by
evt_motion?

--
Taisuke Yamada <tyamadajpspam.rakugaki.org>, http://rakugaki.org/
2268 E9A2 D4F9 014E F11D  1DF7 DCA3 83BC 78E5 CD3A

Message to my public address may not be handled in a timely
manner.
For a direct contact, please use my private address on my
namecard.

#!/usr/bin/ruby

require "wxruby"
include Wx 
 
class MyFrame < Frame
  def initialize
    super(nil, -1, "Locate pointer on keypress")

    evt_key_down do |ev|
      p ev.methods.sort
      p ev.instance_variables
    end
  end
end

class MinimalApp < App
  def on_init
    MyFrame.new.show
  end
end

MinimalApp.new.main_loop
_______________________________________________
wxruby-users mailing list
wxruby-usersrubyforge.org
ht
tp://rubyforge.org/mailman/listinfo/wxruby-users
Pointer position on keypress event?
user name
2006-04-12 00:14:38

Taisuke Yamada wrote:
> I'm using wxruby 0.6.0 (binary package downloaded from
sourceforge).
> Attached is a sample script, but I can confirm 0.6.0
does not
> have get_x/get_y methods nor equivalent instance
variables.
That sounds familiar
> Guess it's time for wxruby2?
> Is there any compiled package available?
We hope to have one soon; people are working on it now.
Rapid 
development of ruby-SWIG has caused a few breakages
> BTW, I tested similar code on C++ wxWidgets, and
wxKeyEvent did
> return proper pointer location with GetX()/GetY(). So
wxruby2
> seems to have its own issue.
OK, sounds like a bug on Mac OS X at least. What platform
are you on?

I've just tested evt_motion with Wx::Window and
Wx::TextCtrl and it does 
have the x and y position available - if you feel like
writing a little 
tracking code.

alex

_______________________________________________
wxruby-users mailing list
wxruby-usersrubyforge.org
ht
tp://rubyforge.org/mailman/listinfo/wxruby-users
[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )