David Gomes
David Gomes

Reputation: 5825

how to create Gtk widgets inside a class in vala?

I have a class that inherits button and it looks like this:

public class MyButton : Button {
     Gtk.Image image; // This doesn't work
}

I need to initiate a GTK Widget that belongs to the class "MyButton". However, I can't really do it. Thanks!

Upvotes: 0

Views: 358

Answers (1)

nemequ
nemequ

Reputation: 17482

It's hard to tell what exactly you're trying to do... If you're trying to set the image property of the GtkButton (see http://developer.gnome.org/gtk/stable/GtkButton.html#GtkButton--image), something like this should work:

public class MyButton : Gtk.Button {
  public MyButton (Gtk.Image image) {
    GLib.Object ();
    this.image = image;
  }
}

Upvotes: 1

Related Questions