Package: gtk
Class gtk:accel-label
Superclassesgtk:label, gtk:misc, gtk:widget, gtk:buildable, gobject:object, common-lisp:standard-object, common-lisp:t Documented Subclasses
None
Direct SlotsDetails The gtk:accel-label widget is a subclass of the gtk:label
class that also displays an accelerator key on the right of the label text,
e.g. "Ctrl+Q".
It is commonly used in menus to show the keyboard short-cuts for commands. ![]() The accelerator key to display is not set explicitly. Instead, the accel label displays the accelerators which have been added to a particular widget. This widget is set by calling the gtk:accel-label-accel-widget function. For example, a gtk:menu-item widget may have an accelerator added to emit the "activate" signal when the Ctrl+Q key combination is pressed. A gtk:accel-label widget is created and added to the gtk:menu-item widget, and the gtk:accel-label-accel-widget function is called with the gtk:menu-item widget as the second argument. The accel label will now display "Ctrl+Q" after its label. Note that creating a gtk:menu-item widget with the gtk:menu-item-new-with-label function, or one of the similar functions for the gtk:check-menu-item and gtk:radio-menu-item widgets, automatically adds a gtk:accel-label widget to the gtk:menu-item widget and calls the gtk:accel-label-accel-widget function to set it up for you. A accel label will only display accelerators which have the :visible value of the gtk:accel-flags flags set. A accel label can display multiple accelerators and even signal names, though it is almost always used to display just one accelerator key. Examples(let (... (item-file-quit (make-instance 'gtk:menu-item :label "Quit"))) ;; Add an accelerator to the QUIT menu item (let ((group (gtk:accel-group-new))) (gtk:window-add-accel-group window group) (gtk:widget-add-accelerator item-file-quit "activate" group (gdk:keyval-from-name "q") :control-mask :visible) ...) ...) | Returned bySlot Access FunctionsInherited Slot Access FunctionsSee also |
#2023-3-15