Stefan Elwesthal wrote:
Hello all!
Just a question from a wxPython rookie!
I read somewhere about a wxPython book being written? Could that actually
be so?
I find it kind of hard starting with wxPython, all I can do is read
demoapps, since the wiki ends too early.
(Like writing editable grids connected to my MySQL instance is'nt there
I have developed an editable grid for my application, and I am happy to
share some ideas. However, it is rather long and complicated, and it is
tightly embedded into my app, so it will not be easy to extract the essence
of it and create a wiki page.
Here are some of the features I have incorporated.
1. Tab or right arrow from the last column takes you to the first column of
the next row. Shift-tab or left arrow from the first column takes you to the
last column of the previous row.
2. Detect when entering or leaving a row, either through keyboard entry or
mouse click. Ability to call a function at each point, typically to read a
database row when entering, and write the row when leaving. The 'leaving'
function can return a flag to prevent leaving the row if certain tests are
not passed.
3. Detect when any cell 'gains focus' or 'loses focus', either through
keyboard entry or mouse click, and call a function.
I am sure there are others, but this is what I can remember off hand. Let me
know if you would like details of any of them.
Very briefly, the trick to achieving 2 and 3 is to maintain your own
variable for the currently active cell, and detect when a new cell is
activated. You can then compare the two and take whatever action is
required.
Frank Millman