Re: Gtk2::SimpleList




On Sunday, May 30, 2004, at 10:47 PM, David lacravate wrote:

En ce jour du Sun, 30 May 2004 21:19:44 -0400,
muppet <scott asofyet org> parlait ainsi :
Right. I'm just getting to the point where I want to use TreeViews
with editable data.
How do I know which row has been edited?
I can call a sub when a row_changed signal is fired, but the sub only
received 2 things: the simplelist that triggered the signal, and a
Gtk2::Gdk::Event::Button ( whatever that is ).

Daniel, looking back at this, i don't know what you're talking about. No TreeModel signal receives GdkEvent. the Gtk2::Gdk::Event::Button describes a mouse button press, release, or motion event; only the TreeView would be getting one of these, but there are no TreeView-specific signals which receive an Event, either. The signals in TreeView's hierarchy which receive a button event as the sole parameter are Gtk2::Widget's button-press-event, button-release-event, and motion-notify-event.

Are you sure you were connected to row-changed on the simplelist's model?

Am I supposed to do something with these to figure out which row has
changed?
no, it's a little more involved than that.
Well , muppet , your answer is detailed and that was certainly the thing to answer . But if Daniel asked for simpler things , here's what i took back from my trip to the wnderful land of the SimpleList .

I may be mistaken but , if not , a simple

    $list->set_column_editable($column,1);

will set the cell edtable in column $column and

    $slist->get_model()->signal_connect("row-changed", \&somesub);

will send informations like a TreeIter and a TreePath to the callback sub, and these things are sufficient to guess which row was edited .

You're right, of course; i'm not sure why i missed that. I blame it on babies. :-)

What i said about needing to customize the cell renderer to do inline validation is still true, though; with this, you'll get a row-changed signal that tells you what row changed, but doesn't tell you whether the value is actually different, doesn't tell you which column was changed, and doesn't give you the opportunity to say "no, this value is bad, don't apply it". If you don't need that sort of stuff, row-changed should work fine.

I should sleep more.

--
muppet <scott at asofyet dot org>




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