[Gtk-sharp-list] Creating Custom Widget Library in MD

Michael Hutchinson m.j.hutchinson at gmail.com
Thu Aug 19 13:33:47 EDT 2010


On Thu, Aug 19, 2010 at 6:54 AM, True Friend <true.friend2004 at gmail.com> wrote:
> I am trying to create a widget library in MD 1.0 (Ubuntu 8.04). I have found
> a webcast in this regard as well, where every thing was explained clearly,
> but.. what I want wasn't there. I just want to subclass a Gtk.Textview to
> override its Keypress Eventhandler method. Now the problem is when I start a
> project as widget library and then add a new widget to it, the default class
> is inherited from Gtk.Bin. But I want it to be inherited from Gtk.Textview.
> If I try to change default code, it creates errors. I am unable to find a
> way to add a text view by visual designer (in this widget library) and then
> set its override OnKeyPressEvent() method. Please guide me in this regard,
> after a lot of search I couldn't find a solution. I'll be very thankful to

Hi,

We no longer support MD 1.0 - I recommend you use a more recent
version of MonoDevelop, so you can simply add the [ToolboxItem]
attribute to GTK widget subclasses in code.

Why do you want to override OnKeyPressEvent - why not use the event?
You can use [Glib.ConnectBefore] on your event handler to have your
handler connect before the textview's own handler.

-- 
Michael Hutchinson
http://mjhutchinson.com


More information about the Gtk-sharp-list mailing list