From lists at ruby-forum.com Wed Jan 2 18:31:40 2013 From: lists at ruby-forum.com (Norbert Lange) Date: Wed, 02 Jan 2013 19:31:40 +0100 Subject: [wxruby-users] Problem inserting row into a grid Message-ID: I'm having a bit of a problem inserting a row (or column) into a grid. I'm using my own custom GridTableBase and created override methods for insert_rows, insert_cols, get_number_rows and get_number_cols. The problem I'm having is that calling the grid.insert_rows method does not properly update the number of rows displayed, and the last row of the table disappears into oblivion even though it still exists in the underlying GridTableBase. The attached code is a simplified version of my code that should illustrate the problem I'm having. Thanks, Norbert Attachments: http://www.ruby-forum.com/attachment/8000/SpreadsheetCodeSample.txt -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Thu Jan 3 00:29:01 2013 From: alex at pressure.to (Alex Fenton) Date: Thu, 03 Jan 2013 00:29:01 +0000 Subject: [wxruby-users] Problem inserting row into a grid In-Reply-To: References: Message-ID: <50E4D0CD.1000401@pressure.to> Hi Norbert On 02/01/13 18:31, Norbert Lange wrote: > I'm having a bit of a problem inserting a row (or column) into a grid. > I'm using my own custom GridTableBase and created override methods for > insert_rows, insert_cols, get_number_rows and get_number_cols. The > problem I'm having is that calling the grid.insert_rows method does not > properly update the number of rows displayed, and the last row of the > table disappears into oblivion even though it still exists in the > underlying GridTableBase I think I ran into a similar problem a while ago. I solved it by re-calling the set_table method, which causes the Grid to inspect the DataSource again to determine the number of rows and columns. See the sub-classed refresh method in http://weft-qda.rubyforge.org/svn/trunk/weft-qda/lib/weft/wxgui/controls/codereview_grid.rb best alex From lists at ruby-forum.com Thu Jan 3 16:51:54 2013 From: lists at ruby-forum.com (Norbert Lange) Date: Thu, 03 Jan 2013 17:51:54 +0100 Subject: [wxruby-users] Problem inserting row into a grid In-Reply-To: References: Message-ID: Hi Alex, I gave your suggestion a try but it results in a segmentation fault when I try to set the table for a second time, even if I do it immediately after the first grid.set_table before any manipulation of the table. C:/Ruby187/lib/ruby/gems/1.8/gems/wxruby-2.0.1-x86-mingw32/lib/wx/classes/grid.rb:34: [BUG] Segmentation fault ruby 1.8.7 (2011-12-28 patchlevel 357) [i386-mingw32] Any other thoughts would be appreciated. Regards, Norbert -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Fri Jan 4 20:51:50 2013 From: lists at ruby-forum.com (Heitor S.) Date: Fri, 04 Jan 2013 21:51:50 +0100 Subject: [wxruby-users] static gem of wxruby 2.0.1 for OS X Snow Leopard In-Reply-To: <43d0f10b7bb80ed573faa5039f64b7fc@ruby-forum.com> References: <80d893c70911110552ye2c5e1ald5cec7b270ebd4b3@mail.gmail.com> <4BA9B9BD.6090602@pressure.to> <43d0f10b7bb80ed573faa5039f64b7fc@ruby-forum.com> Message-ID: <4ef665604f82e34cec5eb1aae4199c4a@ruby-forum.com> Edgar J. Suarez wrote in post #905045: > I've uploaded the gem to amazon S3. > Thanks to Antti for sharing it. > > However it haven't work for me, I may need extra libs or something. > > Anyways, feel free to try it yourselves: > http://j.mp/9vmqne > > Roger Sperberg wrote: >> Alex Fenton wrote: >>> Hi >>> >>> I wonder if anyone who's built on Snow Leopard could let me know what >>> platforms they built for. Have just got round to looking at this, and >>> I'm having trouble building a universal wxWidgets that targets 10.4, >>> 10.5 and 10.6. >>> >>> Is targetting 10.4 still important for users? >>> >>> cheers >>> alex >> >> I can't speak for others, but we have two Macs at our house running 10.5 >> (and will likely move to 10.6 on one of those this month). >> >> Roger Permission denied on link http://j.mp/9vmqne, please repost! Also using Snow Leopard 10.6.8, would greatly appreciate one working gem. -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Fri Jan 4 21:10:41 2013 From: lists at ruby-forum.com (Edgar J. Suarez) Date: Fri, 04 Jan 2013 22:10:41 +0100 Subject: [wxruby-users] static gem of wxruby 2.0.1 for OS X Snow Leopard In-Reply-To: <80d893c70911110552ye2c5e1ald5cec7b270ebd4b3@mail.gmail.com> References: <80d893c70911110552ye2c5e1ald5cec7b270ebd4b3@mail.gmail.com> Message-ID: <7d43b1b9fdb72b5c2388d92548fa6e14@ruby-forum.com> Here http://nydus.zer.gs/wxruby-2.0.1-universal-darwin-10.gem -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Fri Jan 4 23:26:08 2013 From: lists at ruby-forum.com (Norbert Lange) Date: Sat, 05 Jan 2013 00:26:08 +0100 Subject: [wxruby-users] Problem inserting row into a grid In-Reply-To: References: Message-ID: <94ae9fa8b3f9353cbddac48b0c4e737c@ruby-forum.com> After another bit of experimenting, I've found that if I create a new grid and then use the grid.create_grid method() to create a table that inserting rows into that table works. What I'm concluding is that I've implemented something incorrectly in my SpreadsheetTable class or perhaps missed implementing a virtual function properly. Again, any suggestions anyone may have would be appreciated. Regards, Norbert -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Sat Jan 5 17:11:20 2013 From: alex at pressure.to (Alex Fenton) Date: Sat, 05 Jan 2013 18:11:20 +0100 Subject: [wxruby-users] Problem inserting row into a grid In-Reply-To: <94ae9fa8b3f9353cbddac48b0c4e737c@ruby-forum.com> References: <94ae9fa8b3f9353cbddac48b0c4e737c@ruby-forum.com> Message-ID: <50E85EB8.4040009@pressure.to> On 05/01/2013 00:26, Norbert Lange wrote: > After another bit of experimenting, I've found that if I create a new > grid and then use the grid.create_grid method() to create a table that > inserting rows into that table works. What I'm concluding is that I've > implemented something incorrectly in my SpreadsheetTable class or > perhaps missed implementing a virtual function properly. I don't think so; see this on the C++ version: http://stackoverflow.com/questions/8857610/refreshing-wxgrid-with-dynamic-contents Does calling force_refresh() help? It appears to be available in wxRuby. alex From lists at ruby-forum.com Mon Jan 7 16:14:13 2013 From: lists at ruby-forum.com (Norbert Lange) Date: Mon, 07 Jan 2013 17:14:13 +0100 Subject: [wxruby-users] Problem inserting row into a grid In-Reply-To: References: Message-ID: <79760647818046aa19bbe884ad359480@ruby-forum.com> Hi Alex, Calling force_refresh doesn't seem to help. The problem seems to be centered around the grid not properly updating after the underlying table is changed. The following code snippet illustrates I think that the grid is not calling the gtb get_number_rows method except perhaps during the initial grid.set_table call. gtb = SpreadsheetTable.new(["A","B"], ["10","20"], [[1,2],[3,4]]) grid = Wx::Grid.new(panel, -1) grid.set_table(gtb) grid.insert_rows(1,1) grid.force_refresh # Grid thinks there are still just 2 rows puts grid.get_number_rows # Correctly indicates 3 rows puts gtb.get_number_rows Regards, Norbert -- Posted via http://www.ruby-forum.com/.