[Gtk-sharp-list] KeyPressEvent with F-keys and Hotkeys

Jacek Rużyczka stacheldraht at interia.pl
Fri Apr 16 12:54:24 EDT 2010


in my Gtk# app I often define keyboard short-cuts, so that users can simply 
hit a key like [F9] to launch one of the methods I programmed. With the 
KeyPress event, this is theoretically not problematic...but some keys on my 
keaboard return somehow strange keycodes:

		protected virtual void OnKeyPressed (object o, Gtk.KeyPressEventArgs args)
			string key = args.Event.Key.ToString();

For the [F11] key, this returns "L1", and for [F12], this returns "L2". For 
non-standard hotkeys (I own a Cherry CyMotion Master Linux) I sometimes get 
human-readable strings like "Cancel", but sometimes I get crude numbers like 

Now here are my questions:

(i) Is the code "L1" for [F11] normal...I mean, will the [F11] on any keyboard 
map to "L1"? And if someone owns a keyboard with more than 12 F keys (yeah 
yeah, the good old IBM 3270 keyboards with 24 F keys), can this "scheme" be 

(ii) What about keyboards with non-standard hotkeys: There are many, many 
different models on the market, but is there any kind of "standard" in Gtk# 
like the virtual keys (for instance, "VK_CANCEL") in Java?

Thank you for your replies.

Kind regards
Jacek Rużyczka

Ubezpieczenia OC, AC w atrakcyjnych cenach 	 

More information about the Gtk-sharp-list mailing list