Re: Signal for changed checkboxes with SimpleList column type bool?




On Feb 5, 2005, at 11:33 AM, Martin Junius wrote:

I'm using SimpleList with column type bool to get a column with checkboxes, which works as expected. Now I want to trigger a callback when any of the checkboxes are changed. What signal must be connected and how?

  $cell = ($slist->get_column ($index)->get_cell_renderers)[0];
  $cell->signal_connect (toggled => sub {
        my ($cell, $text_path) = @_;
        print "toggled to ".($cell->get_active ? "on" : "off")."\n";
        # note: depending on how you connect the signal,
        # the model may or may not have been updated
        # when this handler runs.
  });


If the checkboxes are the only editable cells in each row, then you know that any change happening to the row is the result of the user toggling the checkbox. In this case, it's simpler to do:

  $slist->get_model->signal_connect (row_changed => sub {
      my ($model, $path, $iter) = @_;
  })


--
"There's a documentary that i wanted to watch on PBS. I heard about it in NPR. ... Oh my god, did i just say that?"
  -- elysse




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