Re: Selectively trapping keypresses

Jeffrey Ratcliffe wrote:
Below is my (non-completing) version of your example. Where am I going
wrong? Or is this not possible with a SimpleList?

Everything's good right up until the end.  ;-)

The SimpleList constructor creates the cell renderer for you.  Your methods
are not affecting the cell renderer in the simple list, because you're
creating a new object that isn't connected to anything.  There's also a bug in
the 'edited' callback.

my $renderer = Mup::CellRendererCompletion->new;

# Get the already-existing renderer for column 0, so we can modify it. my
$renderer = ($slist->get_column (0)->get_cell_renderers)[0];

$renderer->set (mode => "editable",
                editable => TRUE,
                completion => $completion);
$renderer->signal_connect (edited => sub {
 my ($cell, $path, $new_value) = @_;
  $slist->{data}[$path->get_indices][0] = $new_value;

  # This is a list, so $path_string will have only one index, and perl # will
quite happily use the string-containing-number as a number. my ($cell,
$path_string, $new_value) = @_;
  $slist->{data}[$path_string][0] = $new_value;


muppet <scott at asofyet dot org>

muppet <scott at asofyet dot org>

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