Problems getting the TreeIter data for a custom TreeModel



Hi,

For the past couple of weeks, I've been working on a custom TreeModel
that's essentially a proxy for a SQL database.  I've managed to get it
more or less working (I can actually see the whole tree structure :o) but
I'm still having some trouble with TreeIters.

For instance, I've got a set method that looks like this:

sub set {
  my $self = shift;
  my $iter = shift;
        
  die "not my iterator" unless $iter->[0] == $self->{_stamp};

  my %vals = @_;

  while (my ($col, $val) = each %vals) {
    if ($col == NAME_COL) {
      my $sql = "UPDATE list SET name = $val WHERE id = " . $iter->[1];
      $self->{_dbh}->do($sql);
    }
  }
}

But this doesn't seem to work, because the code that calls $model->set
uses an actual Gtk2::TreeIter.  The binding code for the TreeModel
interface converts between array references and GtkTreeIters as necessary
using the iter_from_sv and sv_from_iter functions; is there any way I can
specifically request this conversion from Perl code?  If not, is there
some other way I can get at the data inside the TreeIter?

Any help you can give me would be much appreciated!  I've tried to include
all the information I have about the problem, but if I missed something,
feel free to ask for it :o)

I've also got another TreeIter problem, but it's not related to this, so
I'll put it in another mail.

Thanks!
Zach

-- 
And I say, Give me back my memory, or I'll rip you into three boy scouts
and a watchband!
                                           ---Aaron in "Remind Me Again"
------------------------------------------------------------------------
Zach Bean, zb forty2 com, web forty2 com          http://www.forty2.com

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.



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