PHP-GTK2 Newsletter
|
Sample Code 188: How to add mnemonic to GtkButton? |
| Written by kksou | ||||||
| Thursday, 01 March 2007 | ||||||
|
Problem In How to add mnemonic to GtkLabel?, we added mnemonics, or keyboard accelerators, to GtkLabels. In this example, we will add mnemonics to GtkButtons as shown below:
Solution
Sample Code
Explanation The example above makes use of the code from How to set the button to the exact size you want - Part 3 - group of buttons? to display the three buttons. What's new here:
You can now press Alt-1, Alt-2, Alt-3 to activate these buttons. Note
Note that in the article How to add mnemonic to GtkLabel?, we need to use the method GtkLabel::set_mnemonic_widget() to associate each mnemonic to the widget that will be activated. This method is not required in this example because php-gtk2 is smart enough to automatically associate the mnemonic we set on the button label to its parent (i.e. the button). Related Links
User reviews There are no user reviews yet. Note: You have to be a registered member to leave a comment. Free registration here. |
||||||
| < Prev | Next > |
|---|






