[Gtk-sharp-list] How to use Widget-derived class in MonoDevelop?

Andrey Gankov gankov.andrey at inbox.ru
Thu Jun 15 14:52:28 UTC 2017


MarLOne wrote
> The questions I want to ask for help are:
> 1) How do I use this derived class with the MonoDevelop UI designer? For
> example, inserting MyDataGrid into say a HBox
> 2) How do I refer MyDataGrid in MonoDevelop, without being a Custom Widget
> in the designer?
> 
> After studying the generated code Build(), I managed to follow some of the
> logic to get my test harness 'working' to use MyDataGrid. My technique
> essentially ditches the UI drag-drop way to build up the UI for the part
> where I want to use my derived class.

To show widget in Designer you need add [System.ComponentModel.ToolboxItem
(true)] attribute on widget class like here
https://github.com/QualitySolution/GammaBinding/blob/master/GammaBinding/GtkWidgets/yEntry.cs
After compile it will add to widget right panel. If it not happens, you can
add widget on panel manually by click on plus button and select you assembly
with widget.

So that the widget can be added intro any container widget like HBox, widget
should be inherited from Gtk.Widget class.
http://docs.go-mono.com/?link=T%3aGtk.Widget

Don't exist any Custom Widget class. When you create Custom Widget designer
create your custom class inherited from Gtk.Bin. You can also create your
class manually without designer. 



--
View this message in context: http://mono.1490590.n4.nabble.com/How-to-use-Widget-derived-class-in-MonoDevelop-tp4670855p4670925.html
Sent from the Mono - Gtk# mailing list archive at Nabble.com.


More information about the Gtk-sharp-list mailing list