All Manuals > Common Lisp Interface Manager 2.0 User's Guide > Chapter 11 Commands > 11.10 Advanced Topics

NextPrevUpTopContentsIndex

11.10.5 CLIM Keystroke Interaction Style

Each command table may have a mapping from keystroke accelerator gesture names to command menu items. When a user presses a key that corresponds to the gesture for keystroke accelerator, the corresponding command menu item will be invoked. Command menu items are shared among the command table's menu and the accelerator table. This lets the menu display the keystroke associated with a particular item, if there is one.

Note that, despite the fact the keystroke accelerators are specified using keyboard gesture names rather than characters, the conventions for typed characters vary widely from one platform to another. Therefore the programmer must be careful in choosing keystroke accelerators. Some sort of per-platform conditionalization is to be expected.

Keystroke accelerators will typically be associated with commands through the use of the :keystroke option to define-command (or the application's command defining macro).

add-keystroke-to-command-table [Function]	

Arguments: command-table gesture type value &key documentation (errorp t )

Summary: Adds a command menu item to command-table 's keystroke accelerator table. gesture is a keyboard gesture name to be used as the accelerator. type and value are as for add-menu-item-to-command-table , except that type must be either :command , :function or :menu . command-table is a command table designator.

documentation is a documentation string, which can be used as documentation for the keystroke accelerator.

If the command menu item associated with gesture is already present in the command table's accelerator table and errorp is t , then the command-already-present error will be signaled. When the item is already present in the command table's accelerator table and errorp is nil , the old item will first be removed.

remove-keystroke-from-command-table [Function]	

Arguments: command-table gesture &key (errorp t )

Summary: Removes the command menu item named by keyboard gesture name gesture from command-table 's accelerator table. command-table is a command table designator.

The command-not-present error will be signaled if the command menu item associated with gesture is not in the command table's menu and errorp is t .

map-over-command-table-keystrokes [Function]	

Arguments: function command-table

Summary: Applies function to all the keystroke accelerators in command-table 's accelerator table. function must be a function of three arguments, the menu name (which will be nil if there is none), the keystroke accelerator, and the command menu item; it has dynamic extent. command-table is a command table designator.

map-over-command-table-keystrokes is not recursive. If you want it to descend into submenus, check that the type of the command menu item is eql to :menu before using map-over-command-table-keystrokes recursively.

find-keystroke-item [Function]	

Arguments: gesture command-table &key (errorp t )

Summary: Given a keyboard gesture gesture and a command table, returns two values, the command menu item associated with the gesture and the command table in which it was found. (Since keystroke accelerators are not inherited, the second returned value will always be command-table .)

This function returns objects that reveal CLIM's internal state; do not modify those objects.

Note that gesture may be either a keyboard gesture name of a gesture object. When it is a gesture name, eql will be used to compare the supplied gesture to the gesture names stored in the command table's menu. When it is a gesture object, event-matches-gesture-name-p will be used to do the comparison.

If the keystroke accelerator is not present in command-table and errorp is t , then the command-not-present error will be signaled. command-table is a command table designator.

lookup-keystroke-item [Function]	

Arguments: gesture command-table

Summary: Given a keyboard gesture gesture and a command table, returns two values, the command menu item associated with the gesture and the command table in which it was found. gesture may be either a keyboard gesture name or a gesture object, and is handled in the same way as in find-keystroke-item . This function returns objects that reveal CLIM's internal state; do not modify those objects.

Unlike find-keystroke-item , this follows the submenu chains that can be created with add-menu-item-to-command-table . If the keystroke accelerator cannot be found in the command table or any of the command tables from which it inherits, lookup-keystroke-item will return nil . command-table is a command table designator.

lookup-keystroke-command-item [Function]	

Arguments: gesture command-table &key numeric-arg

Summary: Given a keyboard gesture gesture and a command table, returns the command associated with the keystroke, or gesture if no command is found. Note that gesture may be either a keyboard gesture name of a gesture object, and is handled in the same way as in find-keystroke-item . This function returns objects that reveal CLIM's internal state; do not modify those objects.

This is like find-keystroke-item , except that only keystrokes that map to an enabled application command will be matched. command-table is a command table designator.

numeric-arg (which defaults to 1) is substituted into the resulting command for any occurrence of *numeric-argument-marker* in the command. This is intended to allow programmers to define keystroke accelerators that take simple numeric arguments, which will be passed on by the input editor.

substitute-numeric-argument-marker [Function]	

Arguments: command numeric-arg

Summary: Given a command object command , this substitutes the value of numeric-arg for all occurrences of the value of *numeric-argument-marker* in the command, and returns a command object with those substitutions.

For a description of the CLIM command processor, see 11.9, The CLIM Command Processor .


Common Lisp Interface Manager 2.0 User's Guide - 20 Sep 2011

NextPrevUpTopContentsIndex