Gtk2::Ex::ComboBox::Text -- text combobox with "active-text" property
use Gtk2::Ex::ComboBox::Text; my $combo = Gtk2::Ex::ComboBox::Text->new_text; $combo->append_text ('First Choice'); $combo->append_text ('Second Choice'); $combo->set (active_text => 'Second Choice');
Gtk2::Ex::ComboBox::Text is a subclass of Gtk2::ComboBox,
Gtk2::Ex::ComboBox::Text
Gtk2::ComboBox
Gtk2::Widget Gtk2::Container Gtk2::Bin Gtk2::ComboBox Gtk2::Ex::ComboBox::Text
This is a "text" style convenience Gtk2::ComboBox with the addition of an active-text property, and a couple of pseudo-properties to help filling in the choices.
active-text
+-----------+ | Text One | +-----------+ ...
The active-text property is the same as $combo->get_active_text but as a property can be treated a bit more generally than a method call, for instance link it up to another widget with Glib::Ex::ConnectProperties.
$combo->get_active_text
Glib::Ex::ConnectProperties
$combobox = Gtk2::Ex::ComboBox::Text->new (key => value,...)
$combobox = Gtk2::Ex::ComboBox::Text->new_text (key => value,...)
Create and return a new Text combobox object. new and new_text are the same thing, since a Text combobox is always text style. Optional key/value pairs set initial properties per Glib::Object->new.
new
new_text
Glib::Object->new
my $combo = Gtk2::Ex::ComboBox::Text->new;
$combobox->set_active_text ($str)
The choice $str active, the same as setting the active-text property.
$str
It's slightly unspecified as yet what happens if $str is not available as a choice in $combobox.
$combobox
undef
The text of the selected item, or undef if nothing selected.
append-text
prepend-text
Write-only pseudo-properties which add text choices to the combobox as per the usual append_text and prepend_text methods.
append_text
prepend_text
Gtk2::Ex::ComboBox::Text inherits the usual buildable support from Gtk2::ComboBox, allowing Gtk2::Builder (new in Gtk 2.12) to construct a Text combobox. The class name is Gtk2__Ex__ComboBox__Text and properties and signal handlers can be set in the usual way.
Gtk2::Builder
Gtk2__Ex__ComboBox__Text
The append-text property is a good way to add choices to the combobox from within the builder specification. Either active or active-text can set an initial selection. Here's a sample fragment, or see examples/text-builder.pl in the ComboBoxBits sources for a complete program.
active
<object class="Gtk2__Ex__ComboBox__Text" id="combo"> <property name="append-text">First Choice</property> <property name="append-text">Second Choice</property> <property name="active">0</property> </object>
Gtk2::ComboBox, Gtk2::Ex::ComboBoxBits, Gtk2::Ex::ComboBox::Enum
http://user42.tuxfamily.org/gtk2-ex-comboboxbits/index.html
Copyright 2010, 2011 Kevin Ryde
Gtk2-Ex-ComboBoxBits is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
Gtk2-Ex-ComboBoxBits 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 General Public License for more details.
You should have received a copy of the GNU General Public License along with Gtk2-Ex-ComboBoxBits. If not, see http://www.gnu.org/licenses/.
To install Gtk2::Ex::ComboBoxBits, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Gtk2::Ex::ComboBoxBits
CPAN shell
perl -MCPAN -e shell install Gtk2::Ex::ComboBoxBits
For more information on module installation, please visit the detailed CPAN module installation guide.