# GridTableBase

**URL:** <https://www.ruby-forum.com/t/gridtablebase/127331>\
**Category:** wxRuby\
**Created:** [January 28, 2008, 11:28am UTC](https://www.ruby-forum.com/t/gridtablebase/127331 "2008-01-28T11:28:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![IrlwegS\_Franz\_SZNT](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/3d9bf3/32.png) [@IrlwegS\_Franz\_SZNT](https://www.ruby-forum.com/u/IrlwegS_Franz_SZNT)\
**Post date:** [January 28, 2008, 11:28am UTC](https://www.ruby-forum.com/t/gridtablebase/127331/1 "2008-01-28T11:28:35Z")

</div>

Hello all,  
i’m using wxruby 1.9.4 with Grid and the model class: “GridTableBase”  
like in the code below. But the method set\_table of the grid does’nt  
work. Can anyone help me?

require ‘wx’  
include Wx

class MyGridTableBase \< GridTableBase  
def get\_attr row, col, attr\_kind  
##  
end

def get\_number\_rows  
0  
end

def get\_number\_cols  
0  
end

def get\_col\_label\_value col  
return “empty”  
end

def is\_empty\_cell row, col  
return false  
end

def get\_value row, col  
return “empty”  
end  
end

g = Grid.new  
gt = MyGridTableBase.new  
g.set\_table gt

# i get one of this errors:

# TypeError: in method ‘SetTable’, argument 2 of type 'wxGridTableBase

\*’

# or a “unknown software exception” (0xc0000094) on 0x030dc124 is

thrown

Best Regards,  
Franz

This communication and any files or attachments transmitted with it may  
contain information that is copyrighted or confidential and exempt from  
   
 disclosure under applicable law. It is intended solely for the use  
of the individual or the entity to which it is addressed.   
  
If you are not the intended recipient, you are hereby notified that any  
use, dissemination, or copying of this communication is strictly  
prohibited.   
  
If you have received this communication in error, please notify us at  
once so that we may take the appropriate action and avoid troubling you  
further.   
  
Thank you for your cooperation. Please contact your local IT staff or  
email [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid?subject=Disclaimer)  
if you need assistance.  
   
&nbsp;  
  
Siltronic AG, Sitz München, Hanns-Seidel-Platz 4, 81737  
München, Germany. Amtsgericht München HRB 150884  
   
  
Vorstand: Wilhelm Sittenthaler (Vorsitz), Gerhard Brehm, Paul Lindblad,  
Joachim Manke, Michael Peterat. Vorsitzender des Aufsichtsrats:  
Peter-Alexander Wacker

---

<div class="post-metadata">

**Author:** ![IrlwegS\_Franz\_SZNT](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/3d9bf3/32.png) [@IrlwegS\_Franz\_SZNT](https://www.ruby-forum.com/u/IrlwegS_Franz_SZNT)\
**Post date:** [January 28, 2008, 12:40pm UTC](https://www.ruby-forum.com/t/gridtablebase/127331/2 "2008-01-28T12:40:26Z")

</div>

If this is all top level code, you need to initialize the Wx::App class  
first. When I try this, and change the bottom part where you create the  
new  
grid and gridtablebase, it runs alright.

App.new do  
g = Grid.new  
gt = MyGridTablebBase.new  
g.set\_table(gt)  
end

What platform are you running on?

---

<div class="post-metadata">

**Author:** ![IrlwegS\_Franz\_SZNT](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/3d9bf3/32.png) [@IrlwegS\_Franz\_SZNT](https://www.ruby-forum.com/u/IrlwegS_Franz_SZNT)\
**Post date:** [January 28, 2008, 1:53pm UTC](https://www.ruby-forum.com/t/gridtablebase/127331/3 "2008-01-28T13:53:38Z")

</div>

Hello,  
ok, it was only a code snippet, but normally it should run in a window,  
like in the code below:  
I’m running Windows XP and i always get the error:  
in `set\_table’: in method ‘SetTable’, argument 2 of type  
‘wxGridTableBase \*’ (ObjectPreviouslyDeleted)

require ‘wx’  
include Wx

class MyGridTableBase \< GridTableBase

def initialize rowObjs, objType  
@objType = objType  
@rowObjs = rowObjs  
@colNames = [“aa”, “bb”]  
end

def get\_attr row, col, attr\_kind  
# todo  
“”  
end

def get\_number\_rows  
return @rowObjs.size  
end

def get\_number\_cols  
return @colNames.size  
end

def get\_col\_label\_value col  
return @colNames[col]  
end

def is\_empty\_cell row, col  
return false  
end

def get\_value row, col  
@rowObjs[col]  
end

def set\_value row, col, value  
end

end

class TestWin \< Frame  
def initialize \*args  
super(\*args)  
StaticText.new self, -1, “Test Test Test”  
@g = Grid.new self  
@gt = MyGridTableBase.new [“aa”, “bb”], String  
@g.set\_table(@gt) ## !!!

end

end

class TestApp \< Wx::App  
def on\_init  
frame = TestWin.new(nil, -1, “Grid Sample”,Wx::Point.new(10,  
100),Wx::Size.new(630,400))  
set\_top\_window(frame)  
frame.show()  
end  
end

TestApp.new.main\_loop()

# App.new do

# end

Best regards,  
Franz

* * *

From: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Mario S.  
Sent: Monday, January 28, 2008 12:33 PM  
To: General discussion of wxRuby  
Subject: Re: [wxruby-users] GridTableBase

If this is all top level code, you need to initialize the  
Wx::App class first. When I try this, and change the bottom part where  
you create the new grid and gridtablebase, it runs alright.

App.new do  
g = Grid.new  
gt = MyGridTablebBase.new  
g.set\_table(gt)  
end

What platform are you running on?

On 1/28/08, Irlweg, Franz (ZNT) [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

This communication and any files or attachments transmitted with it may  
contain information that is copyrighted or confidential and exempt from  
   
 disclosure under applicable law. It is intended solely for the use  
of the individual or the entity to which it is addressed.   
  
If you are not the intended recipient, you are hereby notified that any  
use, dissemination, or copying of this communication is strictly  
prohibited.   
  
If you have received this communication in error, please notify us at  
once so that we may take the appropriate action and avoid troubling you  
further.   
  
Thank you for your cooperation. Please contact your local IT staff or  
email [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid?subject=Disclaimer)  
if you need assistance.  
   
&nbsp;  
  
Siltronic AG, Sitz München, Hanns-Seidel-Platz 4, 81737  
München, Germany. Amtsgericht München HRB 150884  
   
  
Vorstand: Wilhelm Sittenthaler (Vorsitz), Gerhard Brehm, Paul Lindblad,  
Joachim Manke, Michael Peterat. Vorsitzender des Aufsichtsrats:  
Peter-Alexander Wacker

---

<div class="post-metadata">

**Author:** ![IrlwegS\_Franz\_SZNT](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/3d9bf3/32.png) [@IrlwegS\_Franz\_SZNT](https://www.ruby-forum.com/u/IrlwegS_Franz_SZNT)\
**Post date:** [January 29, 2008, 8:34am UTC](https://www.ruby-forum.com/t/gridtablebase/127331/4 "2008-01-29T08:34:37Z")

</div>

A lot of thanks,

I thought because GridTableBase is a interface, … but we are in Ruby,  
and here a interface is a class!

franz

---

<div class="post-metadata">

**Author:** ![IrlwegS\_Franz\_SZNT](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/3d9bf3/32.png) [@IrlwegS\_Franz\_SZNT](https://www.ruby-forum.com/u/IrlwegS_Franz_SZNT)\
**Post date:** [January 28, 2008, 11:41pm UTC](https://www.ruby-forum.com/t/gridtablebase/127331/5 "2008-01-28T23:41:24Z")

</div>

Hi Franz

Irlweg, Franz (ZNT) wrote:

> I’m running Windows XP and i always get the error:  
> \*in `set\_table’: in method ‘SetTable’, argument 2 of type  
> 'wxGridTableBase _’ (ObjectPreviouslyDeleted)_  
> …  
> class MyGridTableBase \< GridTableBase
> 
> def initialize rowObjs, objType  
> @objType = objType  
> @rowObjs = rowObjs  
> @colNames = [“aa”, “bb”]  
> end  
> You need to call super() in your constructor. Sorry the (SWIG-generated)  
> exception isn’t very informative, but it’s trying to say that the  
> underlying C++ object hasn’t been initialised.

alex
