Svend Haugaard Sørensen
2009-Dec-05 18:29 UTC
How to make a Grid reread the number of rows in a Table?
I have used GridTableBase to make and display a Table using a Grid. But if I add a new row to the Table the Grid will not display a new row. So if I start with 9 rows in the table and add a row, so there is 10 rows in the table. But the Grid will only display 9 rows. Is seems like the Grid don''t reread the the numbers of rows from the Table. How can I force the Grid to reread the number of rows?
Alex Fenton
2009-Dec-06 05:14 UTC
[wxruby-users] How to make a Grid reread the number of rows in a Table?
Svend Haugaard S?rensen wrote:> I have used GridTableBase to make and display a Table using a Grid. > > But if I add a new row to the Table the Grid will not display a new row. > > So if I start with 9 rows in the table and add a row, so there is > 10 rows in the table. But the Grid will only display 9 rows. > > Is seems like the Grid don''t reread the the numbers of rows from > the Table. > > How can I force the Grid to reread the number of rows?grid.refresh(), I think alex
Svend Haugaard Sørensen
2009-Dec-06 15:50 UTC
[wxruby-users] How to make a Grid reread the number of rows in a Table?
On Sun, 06 Dec 2009 05:14:06 +0000 Alex Fenton <alex at pressure.to> wrote:> Svend Haugaard S?rensen wrote: > > I have used GridTableBase to make and display a Table using a Grid. > > > > But if I add a new row to the Table the Grid will not display a new > > row. > > > > So if I start with 9 rows in the table and add a row, so there is > > 10 rows in the table. But the Grid will only display 9 rows. > > > > Is seems like the Grid don''t reread the the numbers of rows from > > the Table. > > > > How can I force the Grid to reread the number of rows? > > grid.refresh(), I thinkgrid.refresh and grid.force_refresh only update the data in the cells but not the number of rows.> > alex > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users
Svend Haugaard Sørensen
2009-Dec-11 21:08 UTC
[wxruby-users] How to make a Grid reread the number of rows in a Table?
On Sun, 6 Dec 2009 16:50:12 +0100 Svend Haugaard S?rensen <shs at demosophia.net> wrote:> On Sun, 06 Dec 2009 05:14:06 +0000 > Alex Fenton <alex at pressure.to> wrote: > > > Svend Haugaard S?rensen wrote: > > > I have used GridTableBase to make and display a Table using a > > > Grid. > > > > > > But if I add a new row to the Table the Grid will not display a > > > new row.Okay I solved it by dropping the table and making a subclass of Grid. And then using ''append_rows'' and ''delete_rows'' from the Grid class. It seems like ''set_table'' in Grid makes a clone of the table, and thereby make it impossible to manipulate the table directly. Thanks for the help.
Tony Meier
2010-Feb-23 15:27 UTC
[wxruby-users] How to make a Grid reread the number of rows in a Table?
> Okay I solved it by dropping the table and making a subclass of Grid. > And then using ''append_rows'' and ''delete_rows'' from the Grid class. > > It seems like ''set_table'' in Grid makes a clone of the table, and > thereby make it impossible to manipulate the table directly.Can anyone confirm this is the way to go? -- Posted via http://www.ruby-forum.com/.
Tony Meier
2010-Feb-24 19:32 UTC
[wxruby-users] How to make a Grid reread the number of rows in a Table?
Tony Meier wrote:> Can anyone confirm this is the way to go?Answering my own question - yes, that seems to do the trick. When the underlying data changes, simply create a new table (a subclass of GridTableBase to be exact) and call mygrid.set_table again. Voila. -- Posted via http://www.ruby-forum.com/.
Alex Fenton
2010-Feb-24 20:34 UTC
[wxruby-users] How to make a Grid reread the number of rows in a Table?
On 23/02/2010 15:27, Tony Meier wrote:>> It seems like ''set_table'' in Grid makes a clone of the table, and >> thereby make it impossible to manipulate the table directly. >> > Can anyone confirm this is the way to go? >Yes, definitely. I looked at wxWidgets underlying C++ code for this a while back. It clones the C++ object, so it''s likely the Ruby Grid class will continue to have this behaviour. a
Alex Fenton
2010-Feb-24 20:36 UTC
[wxruby-users] How to make a Grid reread the number of rows in a Table?
On 23/02/2010 15:27, Tony Meier wrote:>> It seems like ''set_table'' in Grid makes a clone of the table, and >> thereby make it impossible to manipulate the table directly. >> > Can anyone confirm this is the way to go? >Yes, definitely. I looked at wxWidgets underlying C++ code for this a while back. It clones the C++ object, so it''s likely the Ruby Grid class will continue to have this behaviour. a