Gapp::ComboBox - ComboBox Widget
# basic combo-box Gapp::ComboBox->new( values => [ '', 'Option1', 'Option 2', 'Option 3' ], ); # in this example the combo is populated with array-refs # the text is displayed to the user, and and the integer # can be referenced for programmer user Gapp::ComboBox->new( values => [ [ 0, ' ' ], [ 1, 'Option 1' ], [ 2, 'Option 2' ], [ 3, 'Option 3' ], ], data_func => sub { $_->[1] }, ); # objects too Gapp::ComboBox->new( values => [ $object1, $object2, $object3 ], data_func => 'label', );
This is the column in the model to the ComboBox will reference by default. The values in the column will appear as options to the user. You can manipulate this value using the data_func
attribute.
Use the data_func
to manipulate how an entry in the combo is rendered. The value returned by this function will be displayed to the user. $_
is set to the value held in the model at data_column
for your convienence.
If specified, sets the model of the ComboBox
.
Sets the renderer for the ComboBox
.
If an ArrayRef
is given, the model is populated with the given values. If a CodeRef
is given, the model is populated with the return values of the CodeRef
. If Undef
no values will be added to the model.
Jeffrey Ray Hallock <jeffrey.hallock at gmail dot com>
Copyright (c) 2011-2012 Jeffrey Ray Hallock. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.