GtkWidget::add_accelerator

GtkWidget::add_accelerator

void add_accelerator(string accel_signal, GtkAccelGroup accel_group , int accel_key, GdkModifierType accel_mods, GtkAccelFlags accel_flags );

add_accelerator() defines and adds a keyboard accelerator to the calling widget, usually a GtkMenuItem.

The first parameter is the name of the signal that you want the widget to emit when the key is pressed. Generally this will probably be "activate".

The second parameter is the GtkAccelGroup that this GtkAccelEntry will belong to when it has been created. This will generally be an accelerator group that has been newly created and added to the toplevel window.

Thirdly there is the accel_key parameter. This can be pulled from the GtkAccelLabel using the parse_uline() method if you have an underscore under the appropriate letter, or alternatively you could use the key symbols which have been hard-coded into PHP-GTK. Usually these would be in the format GDK_KEY__a - always in lower case, because the accelerator functions return lower case key values.

The full list of PHP-GTK key symbol hard codings is available in the source code in the file ext/gtk+/php_gdk.c.

The fourth and fifth parameters are GdkModifierType and GtkAccelFlags respectively. In both cases, passing 0 is accepted as a null field.

There is no limit on the number of accelerator keys that can be associated with a widget.

© Copyright 2003-2023 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.