Gtk2::SpinButton with blank value



I'd like to set a Gtk2::SpinButton to a blank value in certain
situations.

set_value() complains that "" isn't numeric, but Gtk2::SpinButton
inherits from Gtk2::Entry, so set_text() should work, but is simply
ignored (or possibly set, and updated to the nearest numeric value, as
happens when entering a blank value manually and hitting return).

Is it doable?

#!/usr/bin/perl
use warnings;
use strict;
use Gtk2 -init;
use Glib qw(TRUE FALSE);             # To get TRUE and FALSE
my $window = Gtk2::Window -> new;
$window -> signal_connect (destroy => sub { Gtk2 -> main_quit } );
my $vbox = Gtk2::VBox -> new;
$window -> add ($vbox);
my $spinbutton = Gtk2::SpinButton -> new_with_range(1, 9999, 1);
$spinbutton->set_numeric (FALSE);
$spinbutton->set_text('');
$vbox -> add($spinbutton);
$window -> show_all;
Gtk2 -> main;

Regards

Jeff



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]