in reply to Gtk2 CellRendererText: how to save the edited value in the cell?
I've found a solution of sorts:
subclass Gtk2::CellRendererText, and patch its START_EDITING method to emit the 'edited' signal when the embedded entry receives a 'focus-out-event'.
package Gtk2::CellRendererTextThatIsNotCompletelyUseless; use Glib::Object::Subclass "Gtk2::CellRendererText"; sub START_EDITING { my ($self, $event, $view, $pathstr, $back_rect, $cell_rect, $flags +) = @_; my $entry = shift->SUPER::START_EDITING(@_); $entry->signal_connect( 'focus-out-event' => sub { my ( $event_box, $event ) = @_; $self->signal_emit( edited => $pathstr, $entry->get_text() +); return 0; } ); return $entry; } 1;
Not elegant, but it appears to work.
I'd also like to nominate the previous reply to this thread to the 2017 Contest of Most Helpful and Well-Considered Forum Replies (and grumble that this place is not what it used to be).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Gtk2 CellRendererText: how to save the edited value in the cell?
by kikuchiyo (Hermit) on Nov 16, 2017 at 18:35 UTC |