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

EchoB
Wed, 27 Feb 2008 16:36:23 -0000

> 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.

Ok. What is the order of operations one should use to define a grid, and
then a gridtablebase?
My dataset is going to change many times at runtime.
Here is the larger picture:
My application is a time tracking application, working like a punch
clock. So projectIDs, TimeIn, TimeOut,
and descriptions can get into the hundreds per week and defiantly per month.
I have an Sqlite3 database with Sequel as the abstraction layer
retrieving the dataset.
I have completed the "data entry" portion of my project. In order for
that information to be useful,
I need to be able to view it, etc. I am passing Sequel datasets to my
derived wxGridTableBase class.
The nature of my dataset is that I would like to adjust the dataset on
an event driven basis.
For example button(s) to switch views between:
week summary of hours
month summary of hours
daily summary of hours
etc..

All ordered by projectID. I can handle the sql queries. But I have yet
to even be able to successfully link the wxGrid to the wxGridTableBase.
I have scoured forums and the wxRuby docs, sample code (BigDemo,
etc...), and asked in #wxruby. Google returns results in wxPython, but
that doesn''t help me.
I guess I just don''t know what I''m doing with it yet.

To sum up:
1) What is the best practice or order of operations for defining a
wxGrid and then linking it to a wxGridTableBase?
2) Is the linking in #1 possible to do on a runtime event-driven basis?
3) Is there any wxRuby demo code anywhere? Or where can I find more
ruby/wxruby ''centric documentation on this class?