PHP-GTK
Wednesday, September 17, 2014 
download | documentation | applications | faq | changelog | resources 


search for in the  


previousGtkScale::set_value_pos
GtkScrollbarnext

Last updated: Sun, 12 May 2013
view this page in English

format-value

Signal which allows the display value of the scale to be changed.

A signal handler can be connected to this signal to allow the display value of the scale to be changed from the default. The callback will be passed both the scale and the current value. The callback should return a string representing the value as it is to be displayed.

Example 110. Formatting the Value of a Scale

<?php
// Callback to format the value of the scale.
function format_value($scale, $value)
{
	return 'Value: ' . $value;
}
 
// Create a window.
$window = new GtkWindow();
 
// Set it up to close cleanly.
$window->connect_simple('destroy', array('Gtk', 'main_quit'));
 
// Create a scale.
$scale = new GtkHScale(new GtkAdjustment(5, 0, 10));
 
// Create a signal handler for the format-value signal.
$scale->connect('format-value', 'format_value');
 
// Add the scale to the window.
$window->add($scale);
 
// Show the window.
$window->show_all();
 
// Start the main loop.
Gtk::main();
?>
This code will produce the window shown below.

Callback function


User Contributed Notes
gtk.gtkscale.signal.format-value.php
add a note about notes
There are no user contributed notes for this page.


previousGtkScale::set_value_pos
GtkScrollbarnext

Last updated: Sun, 12 May 2013
view this page in English


credits 

PHP  Copyright © 2001-2014 The PHP Group
 All rights reserved.
Last updated: Sun May 12 20:50:59 2013 CEST