Forum: wxRuby Wx::Grid and motion events, bug?

Posted by Marvin Gülker (quintus)
on 2010-09-09 09:59
(Received via mailing list)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi there,

Doesn't a Wx::Grid get motion events sent? This code demonstrates the
problem:

- --------------------------------------------------------------
#!/usr/bin/env ruby
#Encoding: UTF-8
require "wx"

class MyFrame < Wx::Frame
  include Wx

  def initialize(parent = nil)
    super(parent, title: "Test", size: Size.new(400, 400))
    self.background_colour = NULL_COLOUR

    StaticText.new(self, label: "") #Dummy
    @grid = Grid.new(self, size: Size.new(300, 200))
    @grid.create_grid(10, 10)
    @grid.evt_motion{|e| p "!"; $stdout.flush}
  end

end

class MyApp < Wx::App
  include Wx

  def on_init
    @mainwindow = MyFrame.new
    @mainwindow.show
  end

end

x = MyApp.new
x.main_loop
- --------------------------------------------------------------

If I hover the mouse above the grid, nothing happens, but if I put in a
panel control instead of a grid, it works. Surprisingly, if I changed
the line

@grid.evt_motion{|e| p "!"; $stdout.flush}

to

THE_APP.evt_motion{|e| p "!"; $stdout.flush}

I get motion events for everything but the grid. As soon as the cursor
enters the grid control, no output arrives anymore.
What's going on here? Is that a bug?

I'm working on Ubuntu Lucid. Here's the uname -a:

Linux ikarus 2.6.32-24-generic #42-Ubuntu SMP Fri Aug 20 14:21:58 UTC
2010 x86_64 GNU/Linux

and here's my ruby -v:

ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-linux]

I compiled both Ruby and wxRuby from source.

Marvin
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkyIk7MACgkQDYShvwAbcNntNQCfcw+zR78b6ZxoTImx+rCRzCeN
khQAnjo4Zcix/0VkZqrwkz3f6x6XpCSM
=tLGS
-----END PGP SIGNATURE-----
Posted by Marvin Gülker (quintus)
on 2010-09-10 16:06
(Received via mailing list)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am 09.09.2010 09:58, schrieb Quintus:
> Hi there,
> 
> Doesn't a Wx::Grid get motion events sent? This code demonstrates the
> problem:
> 

This problem seems to be quite serious. I just noticed that a Wx::Grid
doesn't get ANY mouse events sent:
===========================================================
#!/usr/bin/env ruby
#Encoding: UTF-8
require "wx"

class MyFrame < Wx::Frame
  include Wx

  def initialize(parent = nil)
    super(parent, title: "Test", size: Size.new(400, 400))
    self.background_colour = NULL_COLOUR

    StaticText.new(self, label: "") #Dummy
    @grid = Grid.new(self, size: Size.new(300, 200))
    @grid.create_grid(10, 10)
    @grid.evt_left_down{|e| p "!"; $stdout.flush}
    @grid.evt_left_up{|e| p "!"; $stdout.flush}
    @grid.evt_motion{|e| p "!"; $stdout.flush}
    @grid.evt_left_dclick{|e| p "!"; $stdout.flush}
    @grid.evt_right_down{|e| p "!"; $stdout.flush}
  end

end

class MyApp < Wx::App
  include Wx

  def on_init
    @mainwindow = MyFrame.new
    @mainwindow.show
  end

end

x = MyApp.new
x.main_loop
===========================================================

No way to get a single "!" out of the above program.
Shall I file a bug on the tracker?

Marvin
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkyKOvUACgkQDYShvwAbcNmM+ACeLxUBLq0mFUa62uUHiT1jxHoa
9NMAnAslCNhfTb5OFgsPKXyNf0u9gSjN
=Ikpy
-----END PGP SIGNATURE-----
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.