[wxruby-users] GridTableBase

Irlweg, Franz (ZNT) Franz.Irlweg.ZNT at wacker.com
Mon Jan 28 07:53:04 EST 2008


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: wxruby-users-bounces at rubyforge.org
[mailto:wxruby-users-bounces at rubyforge.org] On Behalf Of Mario Steele
	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) <Franz.Irlweg.ZNT at wacker.com>
wrote: 

		 

</PRE><html><P><SPAN style="FONT-SIZE: 8pt"><FONT color=#000000><FONT face=Arial>
This communication and any files or attachments transmitted with it may contain information that is copyrighted or confidential and exempt from <br>  disclosure under applicable law. It is intended solely for the use of the individual or the entity to which it is addressed. <br>
If you are not the intended recipient, you are hereby notified that any use, dissemination, or copying of this communication is strictly prohibited. <br>
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. <br> 
Thank you for your cooperation. Please contact your local IT staff or email <a href="mailto:info at siltronic.com?subject=Disclaimer">info at siltronic.com</a> if you need assistance.
<br>&nbsp;<br>
Siltronic AG, Sitz M&uuml;nchen, Hanns-Seidel-Platz 4, 81737 M&uuml;nchen, Germany. Amtsgericht M&uuml;nchen HRB 150884
<br>
Vorstand: Wilhelm Sittenthaler (Vorsitz), Gerhard Brehm, Paul Lindblad, Joachim Manke, Michael Peterat. Vorsitzender des Aufsichtsrats: Peter-Alexander Wacker
</FONT></FONT></SPAN></P></html>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20080128/f2720f96/attachment-0001.html 


More information about the wxruby-users mailing list