Gtk2::Ex::FormFactory::List − A List in a FormFactory framework


Gtk2::Ex::FormFactory::List−>new (
attr_select => Attribute name for selection tracking,
attr_select_column => Use this column's value to store in attr_select
columns => Titles of the list columns,
types => Types of the list columns,
editable => Which columns are editable?,
visible => Which columns are visible?
selection_mode => Selection mode of this list,
no_header => Omit header?
update_selection_only => Boolean, whether updates should only
change the selection, not the list
of values,
Gtk2::Ex::FormFactory::Widget attributes


This class implements a List in a Gtk2::Ex::FormFactory framework (based on Gtk2::Ex::Simple::List). The value of the associated application object attribute needs to be a reference to a two dimensional array with the content of the list.


+−−− Gtk2::Ex::FormFactory::List


Attributes are handled through the common get_ATTR(), set_ATTR() style accessors, but they are mostly passed once to the object constructor and must not be altered after the associated FormFactory was built.
= SCALAR [optional]

If you want to track the selection state of the List set the name of the attribute of the associated application object here. An array reference with the indicies of the selected rows (or specific column values if attr_select_column is set) will be managed automatically and stored in this attribute.


Normally indicies of the selected rows are stored in the attribute passed with attr_select. Specify a column number here and the corresponding values will be stored instead (e.g. an internal database ID of an invisible column). If you use this you may use the select_row_by_attr() method as well, which is described below.

columns = ARRAYREF [mandatory]

This is a reference to an array containing the column titles of this list.

types = ARRAYREF [optional]

You may define types for the columns of the list. The type of a column defaults to ’text’. Other possible types are:

text normal text strings
markup pango markup strings
int integer values
double double−precision floating point values
bool boolean values, displayed as toggle−able checkboxes
scalar a perl scalar, displayed as a text string by default
pixbuf a Gtk2::Gdk::Pixbuf

editable = ARRAYREF [optional]

This an array reference of boolean values, one value for each column. Changes to columns marked editable are synchronized automatically with the associated application object attribute.

visible = ARRAYREF [optional]

This an array reference of boolean values, one value for each column and controls the visibility of the corresponding columns. Default is to display all columns.

selection_mode = ’none’|’single’|’browse’|’multiple’ [optional]

You may specify a selection mode for the list. Please refer to the Gtk+ documentation of GtkSelectionMode for details about the possible selection modes.

update_selection_only = BOOL [optional]

If you know the values of your list don’t change at runtime, and only the actual selection is important, you should set this to a true value, because updating will be significantly faster, since only the actual selection is affected.

For more attributes refer to Gtk2::Ex::FormFactory::Widget.


$rows = $widget−>get_selected_rows ()

Returns a list reference of selected row indicies.

$data_lref = $widget−>get_data ()

Returns the data array of the underlying Gtk2::SimpleList. It’s a two dimensional array of rows and columns. All manipulations affect the GUI immediately but bypasses all Gtk2::Ex::FormFactory automatic object value update magic, so be careful with this.

$widget−>select_row_by_attr ($value)

Selects a row by a given select_attr attribute value. Works only if select_attr is set for this list.


Jörn Reder <joern at zyn dot de>


Copyright 2004−2006 by Jörn Reder.

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY ; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.

You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place − Suite 330, Boston, MA 02111−1307 USA.


Hey! The above document had some coding errors, which are explained below:
Around line 402:

Non-ASCII character seen before =encoding in ’Jörn’. Assuming CP1252