GridTableBase - where is the right place to update the DB?

Got the basics to work on a GridTableBase grid.

However not at all sure if using find EVT_GRID_CELL_CHANGE is the right event to use to update the database. Is there not an event I could use which tells when the user gets out of a row (i.e. after he/she updated all columns).

Or should I do this in SetValue of wxPyGridTableBase class, but there I have the same question, is there an event telling me that user moved to another row.

Any hints much appreciated
Werner

Werner F. Bruhin wrote:

Got the basics to work on a GridTableBase grid.

However not at all sure if using find EVT_GRID_CELL_CHANGE is the right event to use to update the database. Is there not an event I could use which tells when the user gets out of a row (i.e. after he/she updated all columns).

Or should I do this in SetValue of wxPyGridTableBase class, but there I have the same question, is there an event telling me that user moved to another row.

You can use EVT_GRID_SELECT_CELL and remember the last selected cell and compare it to the newly selected cell to see if the row has changed.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

For an example of this behavior, open the wxGrid demo from the wxPython demo application, click on "wxGrid using a custom Table, with non-string data"

Select a check box and change the value, then click in the which area below the grid.

···

--
Brian Kelley bkelley@wi.mit.edu
Whitehead Institute for Biomedical Research 617 258-6191

Brian Kelley wrote:

Here's a follow up question. I've noticed that if the data in a grid doesn't take up the entire space of the grid, when a user edits a value and then clicks anywhere outside the data region, the value goes back to the old value. This confuses a *lot* of users.

Is there anyway to change this behavior?

The user needs to TAB or ENTER out of the cell editor in order for the value to be saved.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

This problem has been a sore point with me. It reduces the
user-friendliness of an application. However, I found that disabling the
edit mode temporarily with the EnableEditing() method saves the data.
It can be attached, for example, to a routine used to process the data.
There is still some confusion when the last cell edited is a checkbox.
This is, I guess, due to the different appearance of the editor and
renderer.

···

On Fri, Aug 15, 2003 at 05:44:05PM -0700, Robin Dunn wrote:

Brian Kelley wrote:
>Here's a follow up question. I've noticed that if the data in a grid
>doesn't take up the entire space of the grid, when a user edits a value
>and then clicks anywhere outside the data region, the value goes back to
>the old value. This confuses a *lot* of users.
>
>Is there anyway to change this behavior?

The user needs to TAB or ENTER out of the cell editor in order for the
value to be saved.

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org

--
Bob Parnes
rparnes@megalink.net

Robin Dunn wrote:

Brian Kelley wrote:

Here's a follow up question. I've noticed that if the data in a grid doesn't take up the entire space of the grid, when a user edits a value and then clicks anywhere outside the data region, the value goes back to the old value. This confuses a *lot* of users.

Is there anyway to change this behavior?

The user needs to TAB or ENTER out of the cell editor in order for the value to be saved.

This is not entirely true. If the user clicks the mouse in another grid cell, the values are updated. I guess the update is on entering a new cell not leaving one. I'd rather have the update on leaving a cell (not necessarily when entering a new one). Guess I'll have to investigate the source code :slight_smile:

···

--
Brian Kelley bkelley@wi.mit.edu
Whitehead Institute for Biomedical Research 617 258-6191