[Vala] Gtk TreeView emits a beep ...
- From: raum no-log org
- To: vala-list gnome org
- Subject: [Vala] Gtk TreeView emits a beep ...
- Date: Fri, 15 Nov 2013 15:33:21 +0100
Hello,
I've posted my question in GTK mailing list but no answer for a week... So
I'm trying here. I need to manipulate a treeview, delete an item for
example.
I'm trapped the "release key" event but for certain keys, treeview emits a
beep (left or right arrow, del keys).
How can I remove this "beep" ?
################ CODE sample.vala ############
public class Application : Gtk.Window {
public Application () {
// Prepare Gtk.Window:
this.title = "My Gtk.TreeView";
this.window_position = Gtk.WindowPosition.CENTER;
this.destroy.connect (Gtk.main_quit);
this.set_default_size (350, 70);
// The Model:
Gtk.ListStore list_store = new Gtk.ListStore (2, typeof
(string));
Gtk.TreeIter iter;
list_store.append (out iter);
list_store.set (iter, 0, "Burgenland");
list_store.append (out iter);
list_store.set (iter, 0, "Carinthia");
list_store.append (out iter);
list_store.set (iter, 0, "Lower Austria");
list_store.append (out iter);
list_store.set (iter, 0, "Upper Austria");
// The View:
Gtk.TreeView view = new Gtk.TreeView.with_model (list_store);
this.add (view);
Gtk.CellRendererText cell = new Gtk.CellRendererText ();
view.insert_column_with_attributes (-1, "State", cell,
"text", 0);
view.add_events(Gdk.EventMask.KEY_RELEASE_MASK);
view.key_release_event.connect(on_key_press);
}
public bool on_key_press (Gdk.EventKey event) {
stdout.printf ("keyval: %lu hk: %lu\n", event.keyval,
event.hardware_keycode);
return true;
}
public static int main (string[] args) {
Gtk.init (ref args);
Application app = new Application ();
app.show_all ();
Gtk.main ();
return 0;
}
}
####### Compilation ##################
$ valac --pkg gtk+-3.0 sample.vala
Thanks
Regards
Raum
Adv/pub : https://sourceforge.net/projects/netpackclean/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]