[Gtk-sharp-list] menuBar and gtk.treeview same GUI

Bojan Rajkovic severedcross at gmail.com
Tue Apr 26 12:14:26 EDT 2011


On Apr 26, 2011, at 11:58 AM, luca wrote:

> Hi all, 
> i've to build a desktop application, and i'm using GTK# 
> how can i add multiple widget to the same GUI?
> 
> best regards,
> Luca
> 
> 
> MenuBar mainMenu = new MenuBar();
> //adding content
> this.Add(mainMenu);
> 
> Gtk.TreeView tree = new Gtk.TreeView ();
> //building tree
> 
> this.Add(tree);
> 
> where this is mainwindow
> 
> (testdialog:3691): Gtk-WARNING **: Attempting to add a widget with type
> GtkTreeView to a __gtksharp_0_MainWindow, but as a GtkBin subclass a
> __gtksharp_0_MainWindow can only contain one widget at a time; it already
> contains a widget of type GtkMenuBar
> The application was terminated by a signal: SIGKILL

You'll need to add a VBox or some other container control in order to put more than 1 control in a window. GTK+ works on the basis of containers and relative sizing and positioning, rather than absolute pixel-based positioning like WinForms and other toolkits you may be used to.

—Bojan



More information about the Gtk-sharp-list mailing list