SimpleList questions from a beginner



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...

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"...

I would like to allow the users to move columns around by drag and drop. I was able to change the example program to do this. It wasn't even difficult... However

Question two: What does the column indexing look like after user reordering of columns? It seemed inconsistant to me... When adding data to the list, the original indexing was used. This is what I would expect, since the model shouldn't change by a column reorder. However, the "editable" checkbutton in the program seemed to change the "editable" attribute of the first column in the actual visible table, not the first column in the model. Is this the way it is supposed to be? Is there a way to get around it without listening in to the drag/drop signals and keeping track of what the user has been doing lately?

I would also like the user to be able to edit a cell by selection from a (small) number of alternatives. Something like an OptionMenu in a cell of the table. From my (admittedly incomplete) reading of the docs, the way I'm supposed to do this is by making a customized cell renderer for the graphical presentation, and a customized data type for the actual data to display. How to implement the customized data type is shown in the example.

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?

Bjarne





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