[Gtk-sharp-list] mono and .net runtime discrepancy

alramire@ecs.syr.edu alramire@ecs.syr.edu
Tue, 15 Feb 2005 06:21:13 -0500 (EST)


>> Hello all. I have been able to compile my gtk-sharp app on both mono and
>> .net on win32. However, I can only execute it with mono. When I execute
>> it on .net, either  debugging within visual studio or from the shell, i
>> get an exception (The type initializer for "Gui.EasyTreeview" threw an
>> exception.) from the constructor of a subclassed treeview. My subclass
>> is as follows:
>
>What was the inner exception?
>
>BTW, this method of subclassing is obsolete. Gtk# can handle subclassing
>on its own nicely. You don't need any GType related crap.
>
>-- Ben

Ben, 

I found the problem. I am overriding OnButtonPressEvent to react to button press
 events, so i can use a context menu. I am doing it in my treeview-derived class
as follows:

protected override bool OnButtonPressEvent(Gdk.EventButton evnt)        
{
  bool BaseResult=base.OnButtonPressEvent (evnt);                

  if( ExtendedButtonPressedEvent != null ) 
  {                    
     ExtendedButtonPressedEvent( this, evnt );               
  }                
     return BaseResult;        
}

whenever i remove this, i stop having my constructor exceptions. thanks again. 

alvaro