Wiki source for gtkdialogDocTips9.8


Show raw source

[[HomePage]] > [[SoftwareIndex|Software Index]] > [[SoftwareDevelopment|Development]] > [[gtkdialog|gtkdialog]] > [[gtkdialogDocTips|Tips and Tricks]]

====9.8 Hotkeys====

Here follows 3 different ways of defining hotkeys

**<window>**
An ##<action>## signal inside the ##<window>## widget gives the most direct hotkey
##<action signal="key-press-event" condition="command_is_true( [ $(( ${KEY_MOD} & 5 )) = 5 ] && [ $KEY_RAW = 0x1b ] && echo true )">Refresh:varDATE</action>##
SHIFT's state is held by 0th bit and CTRL state by 2nd bit of ##$KEY_MOD## variable (?????C?S) , so, in order to read their state correctly, we need to discard the rest of bits by logical AND: ##$(( $KEY_MOD & 5 ))##. If we would want SHIFT alone, it would be ##$(( $KEY_MOD & 1)) = 1##, only CTRL - ##$(( $KEY_MOD & 4 )) = 4## and so on.
see [[http://murga-linux.com/puppy/viewtopic.php?t=94163]] for more depth.

**<menuitem>**
Menuitems can set both accelerator key and modifier (SHIFT is 1, CTRL is 4 and ALT is 8 ). For a full list of accelerator key values check [[http://git.gnome.org/browse/gtk+/plain/gdk/gdkkeysyms.h]]
##<menuitem stock-id="gtk-quit" accel-key="0x51" accel-mods="4">##

**<button>**
You can activate buttons by pressing keyboard combinations. simply add the attribute ##use-underline##. If set, an underline in the text indicates the next character should be used for the mnemonic accelerator key.
##<button use-underline="true"><label>_Refresh</label></button>##
The defined char in the ##<label>## + 'alt' key will activate given ##<action>##.

===@@**#%[[gtkdialogDocTips9.7|❰❰❰ Previous]]#% #%[[gtkdialogDocTips|Index]]#% #%[[gtkdialogDocTips9.9|Next ❱❱❱]]#%**@@===
----
==Categories==
CategoryGtkdialog
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki