Wxruby and the use of sizers - Help, Please!

Hello all you happy people!
I am trying to learn wxruby and to that effect I played with the
tutorial,
which is very limited.
I am trying to draw a grid for a sudoku puzzle. I first tried using
GridSizer but then I did not know how to add each cell (button) to the
9x9
grid.
Then I thought that perhaps I should use GridBagSizer for flexibility or
something else.
I need to be able to change the caption of the button, which could have
a
number from 1 to 9, dynamically.
Which class should I use and where can I find examples of it uses?
I searched Google with different search keys but could not really find
any
example.

Your help will be greatly appreciated.

Thank you

Ruby S. wrote:

I am trying to learn wxruby and to that effect I played with the tutorial,
which is very limited.

Questions about wxRuby are more appropriate to the wxruby-users mailing
list:
http://rubyforge.org/mailman/listinfo/wxruby-users
OR WEB ACCESS:
http://www.ruby-forum.com/forum/36

If possible, show some example code with what you’ve tried and you will
find people happy to advise.

I am trying to draw a grid for a sudoku puzzle. I first tried using
GridSizer but then I did not know how to add each cell (button) to the 9x9
grid.

You create and add a button to a sizer with something like this:

sizer = Wx::GridSizer.new(9) # 9 column
button = Wx::Button.new(parent, :label => ‘3’)
sizer.add(sudoku_button)

Then I thought that perhaps I should use GridBagSizer for flexibility or
something else.

Probably not GridBagSizer. It’s offered b/c it’s part of the wxWidgets
API, but there are almost always easier and simpler ways of doing the
same thing, IMHO.

I need to be able to change the caption of the button, which could have a
number from 1 to 9, dynamically.

No problem:

button.label = “4”

Which class should I use and where can I find examples of it uses?

You could use GridSizer + Buttons, as you have been. Simple, but it
might look a bit strange.

You could use Wx::Grid, a spreadsheet-style widget.

A bit more work, but probably the most attractive solution: you could
draw your own grid lines and numbers using a DC (Device Context).

You will find examples of using all of these by looking in the samples
distributed with the wxRuby gem / source. Look in samples/grid,
samples/bigdemo/wxSizer and samples/drawing for help.

a

Alex, thank you for your quick and detailed reply.I will look at the
samples
distributed with wx.

Thank you

Ruby S.