GtkRange::set_update_policy
Sets the widgets update policy to policy. The update
policy describes when the value of the adjustment is changed. When
policy is GTK_UPDATE_CONTINUOUS,
the value of the adjustment is updated while the slider is being moved. If
policy is GTK_UPDATE_DELAYED,
the value of the adjustment will be updated when the user has stopped moving
the slider. When policy is set to
GTK_UPDATE_DISCONTINUOUS, the value of the adjustment
will not be changed until the user has released the mouse button and ended
the slider drag operation.
Anytime the value of the adjustment is changed, the
"value-changed" signal is
emitted.
Example 36. Update Policies
<?php
// A function to see what is happening.
function valueChange() {
echo "A value was changed!\n";
}
// A window and frame for testing.
$window = &new GtkWindow;
$frame = &new GtkFrame('Test Area');
// Create an hscale.
$hScale = &new GtkHScale(new GtkAdjustment(.5, 0, 1, .05, .05, .05));
// Connect the adjustment signal to the above function.
$adj =& $hScale->get_adjustment();
$adj->connect('value-changed', 'valueChanged');
// Switch the uncommented line to see what affect the policy has.
$hScale->set_update_policy(GTK_UPDATE_CONTINUOUS);
//$hScale->set_update_policy(GTK_UPDATE_DELAYED);
//$hScale->set_update_policy(GTK_UPDATE_DISCONTINUOUS);
$frame->add($hScale);
$window->show_all();
gtk::main();
?>
|