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::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.
+-----------+ | Text One | +-----------+ ...
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
$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_text are the same thing, since a Text combobox is always text style. Optional key/value pairs set initial properties per
my $combo = Gtk2::Ex::ComboBox::Text->new;
$str active, the same as setting the
It's slightly unspecified as yet what happens if
$str is not available as a choice in
The text of the selected item, or
undef if nothing selected.
Write-only pseudo-properties which add text choices to the combobox as per the usual
Gtk2::Ex::ComboBox::Text inherits the usual buildable support from
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.
append-text property is a good way to add choices to the combobox from within the builder specification. Either
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.
<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>
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/.