PHP-GTK2 Newsletter
|
Sample Code 498: How to allow user to adjust volume using GtkVolumeButton - Part 1? |
| Written by kksou | ||||||
| Monday, 26 May 2008 | ||||||
|
Problem In the article How to set up volume control - Part 1 - using GtkVScale? we set up a vertical volume control using GtkVScale. In PHP-GTK v2.0 (which is compiled with gtk+2.12), you can use the new widget called GtkVolumeButton to achieve the same functionality. The user interface is slightly different. It comes in the form of a button. When you click on it, a vertical scale will appear for you to adjust the volume as shown below:
Note that the range of the volume is between 0.0 and 1.0, with a stepping of 0.02. Solution
Important Note: This only works for PHP-GTK v2.0 (or PHP-GTK2 compliled with gtk+ v2.12 and above. If you are using an older version, for linux, you may follow the step-by-step instructions to recompile php-gtk2 with gtk+ v2.12. For windows, please refer to How to install php gtk2 on windows? Sample Code
Explanation
Note
If you run the above script, most likely you will get the following error message in the command window: (php.exe:4888): Gtk-WARNING **: Could not find the icon 'audio-volume-muted'. The 'hicolor' theme was not found either, perhaps you need to install it. And the icon doesn't show:
I still have problem setting up the 'hicolor' theme. Don't worry, in the next article, I will show you how to replace the default icon with our own image. 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 > |
|---|






