Jeffrey Ray Hallock > Gapp-0.47.2 > Gapp::ComboBox

Download:
Gapp-0.47.2.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source   Latest Release: Gapp-0.60

NAME ^

Gapp::ComboBox - ComboBox Widget

OBJECT HIERARCHY ^

Gapp::Widget
+-- Gapp::ComboBox

Traits

Gapp::Meta::Widget::Native::Role::FormField

SYNOPSIS ^

  # 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',

  );

PROVIDED ATTRIBUTES ^

data_column
isa Int
default 0

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.

data_func
isa Str|CodeRef|Undef

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.

model
isa Object|Undef

If specified, sets the model of the ComboBox.

renderer
isa Gapp::CellRenderer
default Gapp::CellRenderer->new( gclass => 'Gtk2::CellRendererText', property => 'markup' );

Sets the renderer for the ComboBox.

values
isa ArrayRef|CodeRef|Undef

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.

AUTHORS ^

Jeffrey Ray Hallock <jeffrey.hallock at gmail dot com>

COPYRIGHT & LICENSE ^

    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.
syntax highlighting: