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 <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.
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 <tyamadajp at 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. > > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > > >
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 at 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. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: wx-keydown-and-pointer.rb Url: http://rubyforge.org/pipermail/wxruby-users/attachments/20060411/700cb713/attachment.bat
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