14.5. Using Gtk2::SimpleList for quick and easy lists.

14.5.1. Introduction

The previous lessons on Gtk2::TreeView showed how to create a list or tree view from "first principles". There is a class called Gtk2::SimpleList which is ideal to quickly create a list, avoiding the long route to create it.

In this lesson we will have a closer look at this class.

14.5.2. Advantages

Perl is famous for its data structures. The Gtk2::SimpleList includes a "data" member, which is an array reference. This can then be used to manipulate the list data with Perl's normal array operators.

In the previous sections we had to implement manual signal handling and callbacks to enable changing of row values. (editing text in rows, or toggle a Gtk2::CellRendererToggle's value.). When we use this class, it is all done for us behind the scenes.

To discover which rows has been selected, it features a "get_selected_indices" method. This will return an array of indices, indicating the selected rows.

A sample using this class will be an overkill, and just repeat documentation already available. Read Gtk2::SimpleList's man page to discover its methods and uses reguarding the underlying "data" array.

14.5.3. End message

This brings us to the end of Gtk2::TreeViews. There are many advanced aspects not discussed here, but the aim of this section was to familiarize you with those uses and implementations you are most likely to use.