Re: [Vala] Gtk.CheckMenuItem activate signal is useless (maybe)



Yu Feng пишет:
On Sat, 2009-05-09 at 14:40 +0400, Харин Роман wrote:
so, its litttle code example:

class MyApp : Window {

  private Image main_img;

  public MyApp() {
    ...
    item_viewbg = new CheckMenuItem.with_label("Показывать фон");
    item_viewbg.active = true;
    item_viewbg.activate.connect(onMenuBackImage);
   ...
  }

  void onMenuBackImage(MenuItem menu) {
        main_img.visible = menu.active;
                             ^^^^^^
main_img.visible = (menu as CheckMenuItem).active;

Thank. Is so obviously, my fail. I tried to modify gtk+-2.0.vapi (like
blow to snake from anoder end).


Did you try the old signal connection syntax (using +=)?


Yes, this works too.

// item_viewbg.activate.connect(onMenuBackImage); // <<< can't compile

                                                  // this line
item_viewbg.activate += onMenuBackImage; // this line ok
void onMenuBackImage(CheckMenuItem menu) {
    main_img.visible = menu.active;
}

No, i don't try to use it because it is "old" syntax. hmmm. I can't
understand now: it is new syntax bug or this is undocumented feature?


- Yu
  }
  ...
}

MenuItem has no "active" property, but CheckMenuItem has one.
And i would like to write:

  void onMenuBackImage(CheckMenuItem menu) {
        main_img.visible = menu.active;
  }

but: Cannot convert from `MainWindow.onMenuBackImage' to
`Gtk.MenuItem.activate'

---
Харин Роман,
jabber:// harinr jabber ru

_______________________________________________
Vala-list mailing list
Vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list







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