Re: treeview selected row signal
- From: muppet <scott asofyet org>
- To: anguila <anguila gmail com>
- Cc: gtk2-perl List <gtk-perl-list gnome org>
- Subject: Re: treeview selected row signal
- Date: Sat, 5 Jul 2008 19:51:15 -0400
On Jun 30, 2008, at 4:01 PM, anguila wrote:
I have a treeview and when I click to one of those rows with the
signal cursor-changed I can change the name of a label. Also I have
2 buttons, the first one to add a new row to the treeview and the
other to remove rows. When I remove a selected row I select the row
before (widget->select).
When I click to the row it works, it changes the label, but when i
click to the remove button, only select the row before and doesn't
change the label.
How can I activate the cursor changed signal when I select a row
with ->select? Or is a selected row signal or atleast something like
that?
Try connecting to the "changed" signal on the TreeView's TreeSelection
object, instead. This lets you know every time the TreeView's
selection changes for any reason.
For example:
$treeview->get_selection ()->signal_connect (changed => sub {
my ($selection) = @_;
my ($model, $iter) = $selection->get_selected ();
if (defined $iter) {
my $name = $model->get ($iter, NAME_COLUMN);
$name_label->set_text ($name);
$delete_row_button->set_sensitive (TRUE);
} else {
# can't delete a row if no row is selected
$delete_row_button->set_sensitive (FALSE);
}
});
--
Doing a good job around here is like wetting your pants in a dark
suit; you get a warm feeling, but no one notices.
-- unknown
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]