Hi again Gtk# list, I'm trying to figure out how to grab keyboard input and use it to save a key binding. This is a snippet, I know how to register the binding once I have it, and I know a lot more needs added, but I'm not able to get the keyboard input at all. As it is, OnAccelEntryKeyPress never gets called. How can I get the app so that when the button is clicked, it takes the keyboard input? I really appreciate the help, I'm trying to learn this stuff but I haven't been able to find any real solid documentation for gtk-sharp (so if it's out there, and you just want to send me a link, I'll be more than happy with that). Thanks.
protected virtual void OnKeybindingBtnClicked (object sender, System.EventArgs e) { keybinding_btn.KeyPressEvent += new KeyPressEventHandler (OnAccelEntryKeyPress); //keybinding_btn.Label = "KEYS??"; } void OnAccelEntryKeyPress (object sender, KeyPressEventArgs e) { Gdk.ModifierType mod = e.Event.State; Gdk.Key key = e.Event.Key; string accel = ""; if (mod.Equals ( Gdk.Key.Control_L) || mod.Equals (Gdk.Key.Control_R)) accel = "<Control>"; else if (mod.Equals ( Gdk.Key.Meta_L) || mod.Equals (Gdk.Key.Meta_R)) accel = "<Alt>"; else if (mod.Equals ( Gdk.Key.Alt_L) || mod.Equals (Gdk.Key.Alt_R)) accel = "<Alt>"; keybinding_btn.Label = accel + e.Event.Key; Console.Error.WriteLine (accel + e.Event.Key); } -- --Alex Launi
_______________________________________________ Gtk-sharp-list maillist - Gtk-sharp-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/gtk-sharp-list