[MonoDevelop] Passing arguments to a constructor of a custom widget

Oliver Battenfeld obattenfeld at googlemail.com
Mon Aug 13 07:47:50 EDT 2007


Hi,

I have a class based on Gtk.DrawingArea which I want to use with
MonoDevelop's GUI designer. The widget appears in the toolbox so I can drag
it onto my form but the autogenerated code doesn't seem to care about the
constructor arguments.

My widget needs an instance of another class as a constructor argument:

class MyWidget : Gtk.DrawingArea {
[...]
    public MyWidget(Foo bar) {
    [...]
    }
[...]
}

The autogenerated code doesn't pass any argument like e.g.

myWidget = new MyWidget();

Is there a "nice" solution for this problem? Ideally, I'd like to be able to
specify the constructor argument in the widget's property box (or something
similar).

Thanks for your help!

Bonus question: I'm using two different PCs, both with MonoDevelop 0.14. One
of them doesn't show MyWidget in the toolbox although I'm using the very
same files. MyWidget also appears in the project settings under "GTK#
settings" on both systems. Is there anyway to make MonoDevelop refresh the
toolbox? Or is this more likely to be a bug?

Regards,
Oliver
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/monodevelop-list/attachments/20070813/6807ed45/attachment-0001.html 


More information about the Monodevelop-list mailing list