Re: Gtk2::SpinButton with blank value



Hi,

maybe "output" signal may help. See here:
http://library.gnome.org/devel/gtk/stable/GtkSpinButton.html#GtkSpinButton-output


2008/11/13 muppet <scott asofyet org>:

On Nov 10, 2008, at 3:19 PM, Jeffrey Ratcliffe wrote:

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?


Looking at the C code in gtkspinbutton.c, i think you could override the
GtkEditable's insert_text method with your own thing that allows you to slip
a BlankableSpinButton into a "blank" state.

But we don't have the infrastructure you need to implement your own
overrides for Gtk2::Editable methods.

D'oh.

You could override the insert-text signal, but to get stuff to happen
correctly, you'd either have to reimplement the whole thing from
gtkspinbutton.c or chain up -- and in chaining up, you bump into a
deficiency of Glib::Object::signal_chain_from_overridden(), namely that it
doesn't know how to unmarshal the stuff we give to custom signal marshalers.
 In other words, we crash.

Double d'oh.


So, without binding work, no, not doable by "clean" methods.

You could do dirty stuff like hook into focus-out and prevent it restoring
the numeric value, but that'll be tedious and fragile.


The obvious question is, why do you want to do this?  What are these certain
situations?  Maybe there's another solution that doesn't involve hackery
here...


--
Teeter tots are shaped like marshmallows.
 -- Zella.

_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list




-- 
tadeboro gmail com



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