Re: Validate data entry in a Simple List?



On Wed, 2008-02-27 at 15:33 -0600, Kenneth Swanson wrote:

My problem now is that I want to add some validation logic to some columns, where if a user tries to type 
in an invalid value it will pop up an 
error and refuse to store the value in the list.  I can detect the new value correctly by connecting a 
callback to the CellRendererText's edited 
signal, but I can't seem to stop the SimpleList from storing the new value.

When an "edited" signal handler is called, the model usually still holds
the old value, and you're supposed to store the new value.  So if you
don't like the new value, you just don't store it.  This won't work with
Gtk2::Ex::Simple::List though, since it installs its own "edited"
handler which does store the new value.  Your handler will be called
after that and there's nothing you can do anymore.

Is there a way to stop the new value from getting stored, short of just over-writing it with the old value? 
 Or is this something too complex 
for a 'simple' list?

I don't see a way to do this with Gtk2::Ex::Simple::List currently, no.

-- 
Bye,
-Torsten




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