[wxruby-users] More Adventures with Wx::GridTableBase

Alex Fenton
Thu, 21 Feb 2008 21:09:53 -0000

EchoB wrote:
> I have tried linking a grid to a gridtablebase and gotten mixed results
> but nothing like what i wanted. results have ranged from, nothing to
> crashing the ruby interpreter.
>
Please do report crashes, ideally using the bug tracker. Whatever the
problem, wxRuby should raise an exception rather than segfault. But we
need a complete, self-contained, minimal sample that demonstrates the
problem.
> It seems to me you cannot join a GridTableBase to a Grid w/o having data
> in the GridTableBase first.
> Is this true?
>
Well, whatever your GridTableBase class is, it is obliged to return
meaningful values for the required methods (eg get_number_cols,
get_number_rows) whatever its internal state. From the code you posted,
it seems if the "recordset" is not defined in your GridTable class, it
returns nil for those methods. Which it shouldn''t do - at least return
0.

As I''ve suggested before, I''m not sure why you''re
trying to use
GridTableBase rather than just using a straightforward Wx::Grid and
calling set_value to populate the table whenever the recordset is
changed. It would only really be sensible if your recordset is so huge
that filling the table manually is too slow.

alex