[Vala] Fwd: Can not connect Gtk.Action to a function
- From: Hadi Aminzadeh <hadi60 gmail com>
- To: vala-list gnome org
- Subject: [Vala] Fwd: Can not connect Gtk.Action to a function
- Date: Thu, 4 Feb 2010 11:26:35 +0330
---------- Forwarded message ----------
From: Hadi Aminzadeh <hadi60 gmail com>
Date: Thu, Feb 4, 2010 at 11:01 AM
Subject: Re: [Vala] Can not connect Gtk.Action to a function
To: Nor Jaidi Tuah <norjaidi tuah ubd edu bn>
Sorry, It was a typo in pasting the code in my email.
But the problem still exists with the code below:
var actiongroup = new Gtk.ActionGroup("MainActions");
Gtk.MenuItem menuitem = new Gtk.MenuItem.with_mnemonic("_Actions");
Gtk.Menu actionmenu = new Gtk.Menu();
Gtk.Action test = new Gtk.Action ("Test", "Test", null, null);
actiongroup.add_action (test);
test.activate.connect ((source) => {
sample_func();
});
Gtk.MenuItem testitem = (Gtk.MenuItem) test.create_menu_item();
actionmenu.append(testitem);
menuitem.set_submenu(actionmenu);
menubar.append (menuitem);
....
public void sample_func()
{
debug ("sample function executed");
}
I also used these lines to connect signals to sample_func, but it made no
difference:
test.activate.connect (sample_func);
And:
test.activate += sample_func;
On Thu, Feb 4, 2010 at 10:06 AM, Nor Jaidi Tuah <norjaidi tuah ubd edu bn>wrote:
var actiongroup = new Gtk.ActionGroup("MainActions");
Gtk.MenuItem menuitem = new Gtk.MenuItem.with_mnemonic("_Actions");
Gtk.Menu actionmenu = new Gtk.Menu();
Gtk.Action test = new Gtk.Action ("Test", "Test", null, null);
actiongroup.add_action (test);
test.activate.connect ((source) => {
sample_func();
});
Gtk.MenuItem testitem = (Gtk.MenuItem)
factoraction.create_menu_item();
actionmenu.append(testitem);
menuitem.set_submenu(actionmenu);
menubar.append (menuitem);
....
public void sample_func()
{
debug ("sample function executed");
}
Could this be the elusive bug?
Gtk.MenuItem testitem = (Gtk.MenuItem) factoraction.create_menu_item();
i.e. you visual doesn't correspond to your internal.
hand
Nor Jaidi Tuah
_______________________________________________
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]