Kevin Ryde > Gtk2-Ex-ComboBoxBits > Gtk2::Ex::ComboBox::Text

Download:
Gtk2-Ex-ComboBoxBits-32.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 32   Source  

NAME ^

Gtk2::Ex::ComboBox::Text -- text combobox with "active-text" property

SYNOPSIS ^

 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');

WIDGET HIERARCHY ^

Gtk2::Ex::ComboBox::Text is a subclass of Gtk2::ComboBox,

    Gtk2::Widget
      Gtk2::Container
        Gtk2::Bin
          Gtk2::ComboBox
            Gtk2::Ex::ComboBox::Text

DESCRIPTION ^

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  |
    +-----------+
      ...

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.

FUNCTIONS ^

$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.

    my $combo = Gtk2::Ex::ComboBox::Text->new;
$combobox->set_active_text ($str)

The choice $str active, the same as setting the active-text property.

It's slightly unspecified as yet what happens if $str is not available as a choice in $combobox.

PROPERTIES ^

active-text (string or undef, default undef)

The text of the selected item, or undef if nothing selected.

append-text (string, write-only)
prepend-text (string, write-only)

Write-only pseudo-properties which add text choices to the combobox as per the usual append_text and prepend_text methods.

BUILDABLE ^

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.

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.

    <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>

SEE ALSO ^

Gtk2::ComboBox, Gtk2::Ex::ComboBoxBits, Gtk2::Ex::ComboBox::Enum

HOME PAGE ^

http://user42.tuxfamily.org/gtk2-ex-comboboxbits/index.html

LICENSE ^

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/.

syntax highlighting: