Re: [Vala] How to call base constructors



În data de Mi, 06-05-2009 la 20:08 +0200, Frederik a scris:
Adi Roiban wrote:
I'm trying to extend the Gtk.CheckMenuItem and unfortunately there are
no set_label or set_mnemonic methods.

I was thinking to call the base constructor, but instead of 
gtk_check_menu_item_new_with_label, vala generates
gtk_check_menu_item_construct_with_label

Do you know how can I call a base constructor?

Many thanks!

Here is my example:

public class ProjectMenuItem : Gtk.CheckMenuItem {
    public int id {set; get;}

    public ProjectMenuItem.with_label(string name) {
            base.with_label(name);
    }

    public ProjectMenuItem.with_mnemonic(string name) {
            base.with_mnemonic(name);
    }

}



You could do this as a workaround instead of calling base:

public class ProjectMenuItem : Gtk.CheckMenuItem {
      public int id {set; get;}

      public ProjectMenuItem.with_label(string name) {
              this.label = name;
      }

      public ProjectMenuItem.with_mnemonic(string name) {
              this.label = name;
              this.use_underline = true;
      }
}
Thanks Frederik for your help.
Do we have Gtk.CheckMenuItem.label and Gtk.CheckMenuItem.use_undeline ?
I failed to find those properties.

Anyway, this would be a workaround as, like in the above examples not
all widgets have properties for label.

Cheers,

-- 
Adi Roiban




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]