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 <tyamadajp spam.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-users rubyforge.org
ht
tp://rubyforge.org/mailman/listinfo/wxruby-users |