Package: gtk

Function gtk:accelerator-parse

Lambda List

gtk:accelerator-parse (accelerator)

Arguments

accelerator -- a string representing an accelerator

Return Value

key -- an unsigned integer with an accelerator keyval
mask -- a gdk:modifier-type accelerator modifier mask, or nil

Details

Parses a string representing an accelerator. The format looks like <Control>a or <Shift><Alt>F1 or <Release>z. The last one is for key release.

The parser is fairly liberal and allows lower or upper case, and also abbreviations such as <Ctl> and <Ctrl>. Key names are parsed using the gdk:keyval-from-name function. For character keys the name is not the symbol, but the lowercase name, for example, one would use <Ctrl>minus instead of <Ctrl>-.

If the parse fails, the key argument will be set to 0.

Examples

(gtk:accelerator-parse "<Control>a")
=> 97
=> (:CONTROL-MASK)
(gtk:accelerator-parse "<Shift><Alt>F1")
=> 65470
=> (:SHIFT-MASK :ALT-MASK)
(gtk:accelerator-parse "<Control>minus")
=> 45
=> (:CONTROL-MASK)
(gtk:accelerator-parse "not valid")
=> 0
=> NIL    
 

See also

2023-8-4