[Gtk-sharp-list] Glade, Statusbar Eventbox & Toolbar Combox

XBGM sharp xbgmsharp at gmail.com
Tue Oct 10 08:44:32 EDT 2006


I have made a fully complexe GUI where i construct everything on my own.
I trying to migrate to a Glade GUI so i will be abble to easily
re-design the GUI without changing the code.
I have allready port all the dialog. I having problem with my main window.

Also, i have notice some hard stuff to make with Galde.
For example the toolbar with your own icon. Glade doesn't support
image from resources.
But i find a way to turn around.

So my problem is about statusbar and event box.
The code below is compiling fine, but status bar stuff i not doing anything.
It is the same code than i use with my own interface.
I did get the event box to work but i can't add any label or image.
On my glade file, i only declare a statusbar.

My other problem is than i would like to add a Combox into a toolbar.
Like the statusbar, it is compiling fine, but i don't see anything.

An another question, is why sometimes i don't have to declare the
glade element.
For example, i can modify the window icon or treeview without initializing it.
But it is not working for the textview, Why?

Thanks in advance.

public void CreateGui ()
    Glade.XML gxml = new Glade.XML (null, "test.glade", "window1", null);
    Toptoolbar = (Gtk.Toolbar) gxml["toolbar1"];
    textview = (Gtk.TextView) gxml["textview"];
    statusbar = (Gtk.Statusbar) gxml["statusbar1"];
    gxml.Autoconnect (this);
    // Event

    // Icon
    window1.Title = NAME + " " + VERSION;
    window1.Icon = new Pixbuf(null, "icon.png");
    pix = new Gdk.Pixbuf (null, "logo.png");
    logo.FromPixbuf = pix;

    // Toolbar
    MyToolbar CreateToolbar = new MyToolbar (this);
    Toptoolbar = CreateToolbar.CreateTopToolbar (Toptoolbar);

    // Log view
    buf = textview.Buffer;
    textview.Editable = false;

    // Status bar
    statusbar.Push (1, "Ready.");
    statusbar.Homogeneous = false;
    statuslabel = new Label(" My Stuff ");
    EventBox ebox = new EventBox ();
    ebox.Add (statuslabel);
    ebox.ButtonPressEvent += new ButtonPressEventHandler
    tooltips.SetTip (ebox, " Tooltips ", "");
    statusbar.PackStart(ebox, false, false, 0);
    OnLineStatusImg = new Gtk.Image(Stock.No, Gtk.IconSize.SmallToolbar);
    statusbar.PackStart(OnLineStatusImg, false, false, 0);
    // END of status bar


public Toolbar CreateTopToolbar (Toolbar toolbar)
    //Toolbar toolbar = new Toolbar ();

    toolbar.ToolbarStyle = Gtk.ToolbarStyle.Icons;
    toolbar.IconSize = IconSize.SmallToolbar;

    toolbar.AppendItem ("Connect",
        "Test", String.Empty,
        new Gtk.Image (Stock.Refresh, IconSize.Menu),
        new Gtk.SignalFunc (mainwindow.OnToolbarTestClicked));

    pix = new Gdk.Pixbuf (null, "img.png");
    toolbar.AppendItem (String.Format (_("test")),
        String.Format (_("test tooltip")), String.Empty,
        new Gtk.Image (pix),
        new Gtk.SignalFunc (mainwindow.OnToolbarTestClicked));


    combobox2 = ComboBox.NewText();
    toolbar.AppendWidget (combobox2, "Connected Data Source", String.Empty);
    combobox2.Active = 0;

    return toolbar;

More information about the Gtk-sharp-list mailing list