Documentation‎ > ‎Entries‎ > ‎

gnocl::volumeButton

A volume control widget with suitable icons, tooltips and accessible labels.


Synopsis

gnocl::volumeButton <option val>

Description

The gnocl::volumeButton command will create an instance of a scale-type widget suitable for multimedia applications. By default, a range between 0.0 and 1.0, is set with a stepping of 0.2. Whilst the value is adjusted, a tooltip will appear giving the slider value as a percentage.  The default keyboard bindings top popup this slider are Space, Enter and Return. To popdown, press Escape.

Options

-borderWidth int
Space around the widgets contents in pixels.
-onPopdown string (default: "")
Tcl command which is executed when the volume slider is finished with. Prior to execution, the following substitutions are made:
%w  widget name.
%g   glade/builder widget name
%v  value, a double in the range 0.0 - 1.0
-onValueChanged string (default: "")
Tcl command which is executed when the volume slider values changes. Prior to execution, the following substitutions are made:
%w  widget name.
%g   glade/builder widget name
%v  value, a double in the range 0.0 - 1.0
-value double (default: 0.0)
       
          Set the value to be displayed in the slider. It must be in the range 0.0 - 1.0.
-data string (default: "")
User defined data which can be retrieved via the cget subcommand.
-name  string (default: "")
Name of the widget, can be used to set options in an rc file.
-normalBackgroundColor color
Background colour.

-prelightBackgroundColor color

Background colour. DISCLAIMER_COLOR
-sensitive
Tcl command which is executed when the playing of the sound file is complete. 
-visible
Tcl command which is executed when the playing of the sound file is complete. 

Subcommands

id cget option
Returns the value for one option. The option may have any of the values accepted by configure.
id class
Return the class for this widget object, i.e. 'volumeButton'.
id configure [-option value...]
Configures the widget. Option may have any of the values accepted on creation of the widget.
id delete
Deletes the widget and the associated tcl command.

Example

#!/bin/sh
# the next line restarts using tclsh \
exec tclsh "$0" "$@"

package require Gnocl

set ent [gnocl::label -textVariable vol]
set vb [gnocl::volumeButton]
set box [gnocl::box]
$box add [list $vb $ent]

gnocl::window -child $box

$vb configure -value 1.0
$vb configure -onPopdown {puts "popdown %w"}
$vb configure -onValueChanged {puts "valueChanged %w %v" ; set vol %v}
$vb configure -visible 1
$vb configure -sensitive 1
$vb configure -relief none
$vb configure -borderWidth 20
$vb configure -prelightBackgroundColor green

gnocl::mainLoop




Comments