Lasker has asked for the wisdom of the Perl Monks concerning the following question:
Hi there! I am working on a Gtk-Perl project, but I've just run into trouble. I have a CList and I want to set certain data on each of its rows, but I can't put this get_row_data() to work properly. Here's the code:
foreach (keys %{$dades->[0]}) { $feines[0] = $dades->[0]->{$_}->{'client_id'}; $feines[1] = $dades->[0]->{$_}->{'treb_id'}; $feines[2] = $dades->[0]->{$_}->{'zona_nom'}; $feines[3] = $dades->[0]->{$_}->{'feina_desc'}; $feines[4] = $dades->[0]->{$_}->{'feina_tipus'}; $feines[5] = $dades->[0]->{$_}->{'status'}; my $row = $form->{'feines'}->append(@feines); my $valor = $dades->[0]->{$_}->{'feina_id'}; my $tmp = $valor; # If I don't do this, then get_row_data returns an UNKNOWN ref + afterwards... weird $form->{'feines'}->set_row_data($row, $tmp); print "Fila $row, valor $tmp\n"; } [...] # $event contains the number of the CList row that has been selected, +let's say 1. $glob_rowid = $form->{'feines'}->get_row_data($event); print "Row $event; Data: $glob_rowid"; print Dumper $glob_rowid;
There. Now, let's have a look at STDOUT:
Fila 0, valor 2 Fila 1, valor 1 Fila 2, valor 3 Row 1; Data: SCALAR(0x8640110) $VAR1 = \undef;
Shouldn't this return $tmp? The fact that if I don't do $tmp = $valor gets me to an UNKNOWN ref looks a little bit strange to me... any ideas about *how* get_row_data and set_row_data should be used? (According to Stephen Wilhelm's tutorial, its use should be "self-explanatory"... oops ;P) Am I doing anything else wrong?
As always, any help will be greatly appreciated :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Gtk-Perl $CList-get_row_data() problems
by count0 (Friar) on Jan 08, 2002 at 03:48 UTC | |
by Lasker (Beadle) on Jan 08, 2002 at 04:24 UTC |