Re: SimpleList questions from a beginner



Bjarne Steinsbø said:
Warning! I'm completely new to gtk-perl, with no prior experience
writing gnome apps in other languages.  I've been using Perl-Tk for some
years, though, but the amount of documentation to read for Gnome
development is overwhelming.  And no, I haven't read it all yet...

althought the gnome/gtk/gtk2-perl documentation may be overwhelming believe me
in the end that's a good thing. in reality there's no shortage of stuff that
needs documenting that isn't. we've tried to be very thorough with Gtk2-Perl
as well.

Background: I've started writing an application which will have data
stored in a MySQL database.  The plan is to use the TreeView widget for
editing/navigation/selection tasks within this data store.  To prepare
this part of the project, I've started playing around with the
"simplelist.pl" example (from 1.00rc3), just to get familiar with the
widget.

Question one: I noticed that I couldn't "push" an array to the
SimpleList.  Instead, I had to push row by row.  Is this a bug, or is it
meant to work this way?  Looking at the implementation, I would guess
the same applies to "unshift"...

the fill button/branch shows how to completely replace the data in the list
with an array of array references (read array of rows.) i'd have to know more
exactly what you're trying to do to tell what is/isn't the case with
push/unshift, it can get kinda tricky.

...

Question three: Am I on the right track?  Does anybody have any example
code for customized renderers I could look at?  Would I have to write
the renderer in C, or is the class inheritance between GObjects and perl
classes transparant enough for me to write my own class that inherits
from Gtk::CellRenderer and take it from there?

you're doing some pretty fancy things and you may be better of working
directly with the mvc stuff, or perhaps making your own 'ComlexList' widget,
modled on SimpleList that is better suited for your needs. SimpleList was
intended to be a way for someone that doesn't under stand all of the mvc stuff
to put a list widget in their app with only a few mins work, but obviously
it's capible of more. but at some point you'll run into it being more trouble
than it's worth. those type of 'extensions' are where Gtk2-Perl will have room
tro grow/improve after the initial wrapper libs are done. and i suspect they
will, whether the gtk2-perl teams does it or others.

as for customized renderers i would suspect you'd have better luck doing those
in C and then writting wrappers for them, but in theory it would be possible.
there's plenty of doc on writting your own widgets, that's the starting point,
either way it's going to be some work. a possible, although perhaps not ideal,
workaround is to have the editing take place in a dialog that is created on
the double click signal, it would be simplier to do, but not quite as smooth.

-rm



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