I am attempting to add controls inside a Wx::Grid. I added a Wx::Panel as a
child of the grid, then added a control to that panel. In the actual code,
the child panel would be sized and located inside a single grid cell, but I
simplified the example code.
On linux with GTK, this code performs as expected--you get a green panel
with a clickable button in it. On windows XP, however, the grid and panel
have painting conflicts. The panel paints over the grid in the label
section, but the grid cells paint over the panel. Also, the panel does not
receive mouse events, making the button unclickable. Instead, the mouse
events go to the underlying grid.
Any ideas?
Abram
require ''wx''
class MainApp < Wx::App
def on_init
frame = Wx::Frame.new(nil, -1, "My Frame",
Wx::Point.new(50, 50),
Wx:: Size.new(450, 340))
panel = MyPanel.new(frame, -1, Wx::DEFAULT_POSITION,
Wx::DEFAULT_SIZE)
frame.show()
end
end
class MyPanel < Wx::Panel
def initialize (parent, id, pos, size)
super(parent, id, pos, size)
grid = Wx::Grid.new(self, -1, Wx::DEFAULT_POSITION, Wx::Size.new
(400,400))
grid.create_grid( 2, 2 )
panel = GridChildPanel.new(self, -1, pos, Wx::Size.new (100,100))
end
end
class GridChildPanel < Wx::Panel
def initialize(parent, id, pos, size)
super(parent, id, pos, size)
set_background_colour(Wx::GREEN)
button = Wx:: Button.new(self, -1, ''Push me'')
end
end
app = MainApp.new
app.main_loop()
_______________________________________________
wxruby-users mailing list
wxruby-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/wxruby-users