Dynamically loading wx widgets

Kris Luyten <[email protected]>
Newsgroups gmane.comp.lib.wxwindows.wxnet
Organization EDM/LUC
Message-ID <1071508341.3288.40.camel@kluyten>
Hi,

I am trying to dynamically load WxWindows widgets from the wx.NET.dll,
but I am getting some weird errors (I am using mono 0.29, gtk# 0.14 on
Linux, and Wx.Net from CVS a couple of weeks ago).

This is the code: 
======
Assembly wxAssembly = Assembly.Load("wx.NET.dll");
Type wxClassType = wxAssembly.GetType("wx.Button");
System.Object wxObject = Activator.CreateInstance(wxClassType); 
======
See http://lumumba.luc.ac.be/kris/projects/uiml.net/test11.cs for a
easy-to-compile .cs file.

and this results in a trace of errors that never stops:
======
(test11.exe:3577): GLib-GObject-CRITICAL **: gtype.c:1871:
initialization assertion failed, use g_type_init() prior to this
function
...
======

Adding "Gtk.Application.Init();" before the other statements helps, but
then I get this output:
======
Unhandled Exception: System.Reflection.TargetInvocationException:
Exception has been thrown by the target of an invocation. --->
System.NullReferenceException: A null value was found where an object
instance was required
in (unmanaged)
/usr/local/lib/libwx-c.so(__eq__C8wxCursorRC8wxCursor+0x9) [0x419a7bf5]
in (unmanaged) 
...
======
If someone knows the solution for this problem, please let me know.

For who is wondering why to load the widgets dynamically, I am trying to
add WxWindows widgets to my Uiml.net User Interface renderer
(http://lumumba.luc.ac.be/kris/projects/uiml.net/).

Best wishes,
Kris
-- 
Kris Luyten
email: [email protected]
http://lumumba.luc.ac.be/kris/projects/uiml.net



-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.