wx.grid -- How to quickly display only those rows matching a criterion?

Bob Klahn wrote:

Let's say I have a wx.grid grid containing 2000 rows, with text strings in column 0.

The user can scroll through this grid, just like any other grid, =or= can press a certain key combo, say <ctrl-?>. and be prompted for a search string. Say that search string is found in a handful of those 1000 rows. The application must quickly show the user just those rows.

The user could then press <ctrl-?> again and specify a different search string, at which point the application must be able to quickly show just those rows. Selected from the full 1000-row grid, not just from the currently-displayed rows. All without flicker.

The question: What's the best way to accomplish the above?

Do the magic in your table class. When you process the filter the table can figure out which rows match and how many there are, tell the grid how many are in the result set, tell it to redraw, and then map the requests that the grid will make to the real values. For example if the first matching row is 5 then when the grid asks for the value of a cell in the 0th row your table would give it the value from the real 5th row instead, and so on.

···

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

Marc, I'm an American crossword constructor, and I'd be, uh, excommunicated if I made that error!

Bob

···

At 06:25 PM 1/30/2008, you wrote:

I am SOOOO glad to see the word "criterion" used properly... There was a contest in GAMES magazine back in the late 80's/early 90's to come up with new grammar mnemonics (along the lines of "I before E, except after C...") My favorite of the finalists was the following:

There is only one
Criterion.
Folks inferia
Say "one criteria."

Totally off-topic, and grammar-fascistic, but I just thought I'd drop that into the mix.

So there ARE people even snarkier than I? Good to know!

···

On Jan 30, 2008 3:49 PM, Bob Klahn bobstones@comcast.net wrote:

Marc, I’m an American crossword constructor, and I’d be, uh,
excommunicated if I made that error!


www.fsrtechnologies.com