Wx::DBI::Form::Grid::CellComboRender - database aware combo box for the grid


NAME

Wx::DBI::Form::Grid::CellComboRender - database aware combo box for the grid

Back to Top


SYNOPSIS

use Wx::DBI::Form::Grid::CellComboRender

Back to Top


DESCRIPTION

Wx::DBI::Form::Grid::CellComboRender allows for database aware combo boxes in the grid.

The purpose here is to show the "name" of a database item rather than the "id" that is actually given.

To do this we need a lookup list of all the possible "name" -> "id" pairs.

This can be created with a simple query, probably from the parent object, a reference to which will be provided to us for use.

This way only one list has to be created per column of data rather than duping it for each row in a column.

This also leaves us flexible enough to do each row individually just by generating the list on a row by row basis.

Back to Top


FUNCTIONS

new($class, $combodataref)
Parameters:

$combodataref is a reference to the items that belong in the ComboBox.

Functionality:

Creates a GridCellRenderer based on Wx::PlGridCellRenderer (the Perl-specific version of wxGridCellRenderer).

Return value:

A new Wx::DBI::Form::Grid::CellComboRender object.

replace_combo_data($self, $combodataref)
Parameters:

$combodataref is a reference to the items that belong in the ComboBox.

Functionality:

Replaces the data in the ComboBox.

Return value:

None.

add_combo_data($self, $combodataref)
Parameters:

$combodataref is a reference to the items that belong in the ComboBox.

Functionality:

Adds the data to the ComboBox.

Return value:

None.

Draw($self, $grid, $attr, $dc, $rect, $row, $col, $sel)
Parameters:

FIXME - fill this in

Functionality:

Get the grid value and substitute it for the actual name of the id from the combo data.

Note: this function has a camel case name because it overrides a super-class function.

Return value:

None.

Clone($self)
Functionality:

Returns a clone of the object instance.

Note: this function has a camel case name because it overrides a super-class function.

Return value:

A clone of the object instance.

get_text_from_id($self, $id)
Parameters:

$id is the id of a particular item in the combo's data for which we want a textual representation.

Functionality:

Traverse throught the (-name/-value) array/hash of the combo data and find the value that matches the id given.

Return value:

The -name that corresponds to the -value.

Back to Top


AUTHORS

Doug Breshears <doug@jshfarms.com>
Roberto C. Sanchez <roberto@connexer.com>

Back to Top


BUGS

No known bugs.

Back to Top


SEE ALSO

README

Back to Top


COPYRIGHT

Copyright 2008-2009 JSH Farms, Inc.

Wx::DBI 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 of the License, or (at your option) any later version, or under the terms of the Artistic License as published by the Perl Foundation, either version 2.0 of the license, or (at your option) any later version.

Wx::DBI 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 or the Artistic License for more details.

You should have received a copy of the GNU General Public License and a copy of the Artistic License along with Wx::DBI. If not, see <http://www.gnu.org/licenses/> and <http://www.perlfoundation.org/artistic_license_2_0>, respectively.

Back to Top

 Wx::DBI::Form::Grid::CellComboRender - database aware combo box for the grid