Opened 6 years ago

Last modified 6 years ago

#14890 confirmed defect

wxGrid generates events in different order on leaving an edited cell

Reported by: hakki_dogusan Owned by:
Priority: low Milestone:
Component: wxGrid Version: stable-latest
Keywords: Cc:
Blocked By: Blocking:
Patch: no

Description

This can be seen in griddemo sample.

  • start demo
  • click C3 cell
  • type 888
  • click C4 cell

...
Left click at row 2, col 2
Deselected cells from row 0 col 0 to row 99 col 99...
Selected cell at row 2 col 2...
Cell editor shown.
Cell editor hidden.
Value of cell at (2, 2): about to change from "red" to "888"
Value of cell at (2, 2) changed and is now "888" (was "red")
Left click at row 3, col 2
Deselected cells from row 0 col 0 to row 99 col 99...
Selected cell at row 3 col 2...

  • start demo
  • click C3 cell
  • type 999
  • press Enter

...
Left click at row 2, col 2
Deselected cells from row 0 col 0 to row 99 col 99...
Selected cell at row 2 col 2...
Cell editor shown.
Deselected cells from row 0 col 0 to row 99 col 99...
Selected cell at row 3 col 2...
Cell editor hidden.
Cell editor hidden.
Value of cell at (2, 2): about to change from "red" to "999"
Value of cell at (2, 2) changed and is now "999" (was "red")

Problems for the second scenario (keyboard one):

  • "Selected cell" event triggered before data change
  • "Cell editor hidden" generated twice

Attachments (1)

grid.patch download (1.2 KB) - added by hakki_dogusan 6 years ago.

Download all attachments as: .zip

Change History (3)

Changed 6 years ago by hakki_dogusan

comment:1 Changed 6 years ago by hakki_dogusan

  • Attached patch makes "selected cell" event to generated after data change (as mouse one)
  • One of "Cell editor hidden" event comes from wxGridCellEditorEvtHandler::OnKillFocus(wxFocusEvent& event) but it seems harmless

With patch log is as follows:

  • start demo
  • click C3 cell
  • type 999
  • press Enter

...
Left click at row 2, col 2
Deselected cells from row 0 col 0 to row 99 col 99...
Selected cell at row 2 col 2...
Cell editor shown.
Cell editor hidden.
Cell editor hidden.
Value of cell at (2, 2): about to change from "red" to "999"
Value of cell at (2, 2) changed and is now "999" (was "red")
Deselected cells from row 0 col 0 to row 99 col 99...
Selected cell at row 3 col 2...

comment:2 Changed 6 years ago by vadz

  • Milestone 2.9.5 deleted
  • Priority changed from normal to low
  • Status changed from new to confirmed

I am not sure if the logic of this patch is correct because the editor is now hidden unconditionally while in the current code it's not hidden if the cell change event is vetoed. I don't know if it's important to keep editing the cell if this happens but I think it might be.

I'm also not sure why did the call to DisableCellEditControl() in wxGrid::DoGridProcessTab() have to be removed?

Note: See TracTickets for help on using tickets.