Does Gtk# have an Enum for key values?
Question
In my code, I have messy things like
// Enter key
if (args.Event.KeyValue == 65293)
...
Is there any Enum I can use for this, instead of hard-coding the values?
Solution
Yes: Gdk.Key in the gdk-sharp.dll assembly.
if (args.Event.KeyValue == Gdk.Key.Return) {
...
}
OTHER TIPS
args.Event.Key is the same thing, but as a Gdk.Key enum instead of a uint, so if you were to Console.WriteLine it, you'd get the nice name instead of the uint value.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow