Wx::DBI::Form::Grid - a database aware grid


NAME

Wx::DBI::Form::Grid - a database aware grid

Back to Top


SYNOPSIS

use Wx::DBI::Form::Grid

Back to Top


DESCRIPTION

Wx::DBI::Form::Grid is a class combining Wx::Grid and Wx::DBI::Form.

Back to Top


FUNCTIONS

new($class, $parent)
Parameters:

$parent is the parent widget of the grid to be created.

Functionality:

Create a new empty Wx::DBI::Form::Grid object.

Return value:

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

set_parentform($self, $parentform)
Parameters:

$parentform is the new parent of the grid.

Functionality:

Sets a new parent form for the grid.

Return value:

None.

register_exit_event_handler($self, $col, $handler)
Parameters

$col is the column for which the handler is being registered. $handler is a reference to the handler function to assign.

Functionality:

Registers an event handler to call when a cell is exited. Use Wx::DBI::Form::Grid::on_ed_hide() to trigger a call to an external event handler.

Return value:

None.

register_change_event_handler($self, $col, $handler)
Parameters

$col is the column for which the handler is being registered. $handler is a reference to the handler function to assign.

Functionality:

Registers an event handler to call when a cell is changed.

Return value:

None.

on_ed_hide($self, $evt)
Parameters:

$evt is the Wx::Event object.

Functionality:

Handle when the cell editor is hidden.

Return value:

None.

on_child_focus($self, $evt)
Parameters:

$evt is the Wx::Event object.

Functionality:

This is the first event that actually fires when you left click on a cell.

Now as far as I can tell there is no way to get the cell coordinates that recieved the focus from that event so the only thing it is really good for it to tell you. "Hey A cell that wasn't selected before is now selected".

The main thing it is used for here is for an exit handler. Since exit events are not very cut and dried it is important to track what is going on and run the exit handlers approriately.

on_ed_hide (event method for EVT_GRID_EDITOR_HIDDEN) is the only place that sets the _exit_evt_pending flag and

on_lost_focus && on_child_focus (here)

Are the only places it is checked and acted upon.

Return value:

None.

run_change_handlers()
Parameters:

$evt is the Wx::Event object.

Functionality:

Runs the handlers in the queue for when the cell is changed. The OnChange Event only fires when the widget has exited and is prepared to show the change. The OnChange Event handler is the only user of this method.

Return value:

None.

run_exit_handlers($self)
Functionality:

Run the handlers in the queue for when the cell is exited.

Return value:

None.

on_cell_change($self, $evt)
Parameters:

$evt is the Wx::Event object.

Functionality:

Handles saving the data when the cell's contents have changed. Trying to figure out how to get a cell to 'save' its data w/o having to select another cell. It is too easy to type data in a cell and then click the "save" button with the mouse w/o going to another cell in between. FIXME - Is this still true??

Unfortunately this causes the data entered into that cell to not be completely saved.

Currently this handler fires after the save function has processed all the data and has refreshed the form.

Return value:

None.

on_lost_focus($self, $evt)
Parameters:

$evt is the Wx::Event object.

Functionality:

Handle the event when a cell loses the focus.

When the grid looses focus it is for two reasons. 1) The user has selected something outside the grid or even the application. 2) The user has enabled a grid cell editor that causes this event to fire.

We have to differentiate between the two to make sure we don't do the wrong thing

Return value:

None.

on_ed_show ($self, $row, $col)
Parameters:

$row,$col are the grid coordinates that the editor was created on.

Functionality:

Notify the grid that an editor is active. This allows us to know that we need to close it when the grid loses focus.

Return value:

None.

on_cell_select($self, $evt)
Parameters:

$evt is the Wx::Event object.

Functionality:

Handle the event when a cell is selected.

Return value:

None.

on_ed_create($self, $evt)
Parameters:

$evt is the Wx::Event object.

Functionality:

Handle the event when an editor is created (i.e., the user starts to change the data in the cell).

Return value:

None.

on_cell_left_click($self, $evt)
Parameters:

$evt is the Wx::Event object.

Functionality:

Makes the all the Cell Editors activate in one click. Copied from: http://www.codeguru.com/cpp/controls/combobox/. Labeled: "Improving the Functionality of Comboboxes in wxGrid".

Return value:

None.

on_key_down($self, $evt)
Parameters:

$evt is the Wx::Event object.

Functionality:

Handles the event when a key is pressed down, with a special case for handling when the user presses ^D.

Return value:

None.

last_selected($self, $row, $col)
Parameters:

($row, $col) represents ... FIXME

Functionality:

Return the row and column of the last selected cell in the grid.

Return value:

The row and column of the last selected cell in the grid.

set_col_type($self, $column, $type)
Parameters:

$column is the column on which to operate and $type is the type to make the specified column.

Functionality:

Currently only the type "Combo" is supported, which turns the column into a column of ComboBox cells with associated editors and renderers.

Return value:

None.

replace_combo_items($self, $column, $items)
Parameters:

$column is the column to be modified and $items is a reference to the list of items with which to replace the contents of the ComboBox.

Functionality:

None.

Return value:

None.

append_combo_items($self, $column, $items)
Parameters:

$column is the column to be modified and $items is a reference to the list of items to append to the contents of the ComboBox.

Functionality:

None.

Return value:

None.

get_col_editor($self, $column)
Parameters:

$column is the column for which an editor is desired.

Functionality:

Return an editor for the specified column.

Return value:

An editor for the specified column.

get_col_renderer($self, $column)
Parameters:

$column is the column for which a renderer is desired.

Functionality:

Return a renderer for the specified column.

Return value:

A renderer for the specified column.

append_row_if_needed($self, $row)
Parameters:

$row is the number of the row which will be checked for existence, and created if necessary.

Functionality:

Check to see if the specified row exists and append it if the row does not already exist.

Return value:

None.

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 - a database aware grid