How to force a listbox to finish a EditCell

How can I force a listbox to finish the user editing a cell so that the listbox.CellAction will fire?

I have a window where the user edits the contents of a listbox. On listbox.CellAction I save stuff.

If the user closes the window, the listbox.CellAction fires during the close event but the user changes are lost.

Can I force the listbox to finish editing the cell before I fire the close event?

make a global method to save the changes
call the method when the cella ction fires OR when the user closes the window

The problem is I store the changed data on Cell Action then on window close I collate that to where it needs to go.

[quote=413356:@Stephen Dodd]How can I force a listbox to finish the user editing a cell so that the listbox.CellAction will fire?

I have a window where the user edits the contents of a listbox. On listbox.CellAction I save stuff.

If the user closes the window, the listbox.CellAction fires during the close event but the user changes are lost.

Can I force the listbox to finish editing the cell before I fire the close event?[/quote]

You can call Editcell on a different listbox cell in the windows cancelclose or close event. That forces the running edit to finish.

Why don’t you use the CellLostFocus event instead???

Put listbox.SetFocus() inside CancelClose so you move focus from the cell to the listbox itself, this also stops this crash happening feedback://showreport?report_id=52488 in windows. It has to go in CancelClose or it will stop the window from actually closing due to the lateness of the focus change and I assume some bug with late cleanup of objects keeping the instance alive, but I digress :wink:

Thanks. That works a charm.

Thanks. That might work too.

Thanks! I’d do that but it’s in a container and slightly more difficult to access the cancelClose event from there.

I signed onto the bug!