How to force a listbox to finish a EditCell

  1. 6 days ago

    Stephen D

    Nov 8 Pre-Release Testers

    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?

    @Stephen D 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?

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

  2. Jean-Yves P

    Nov 8 Pre-Release Testers, Xojo Pro Europe (France, Besançon)

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

  3. Stephen D

    Nov 8 Pre-Release Testers

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

  4. Jason P

    Nov 8 Xojo Inc Answer http://xojo.com/

    @Stephen D 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?

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

  5. Markus W

    Nov 8 Pre-Release Testers, Xojo Pro #JeSuisHuman Germany, Heidelb...

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

  6. Julian S

    Nov 9 Pre-Release Testers, Xojo Pro UK
    Edited 6 days ago

    Put listbox.SetFocus() inside CancelClose so you move focus from the cell to the listbox itself, this also stops this crash happening Feedback Case #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 ;)

  7. 2 days ago

    Stephen D

    Nov 12 Pre-Release Testers

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

    Thanks. That works a charm.

  8. Stephen D

    Nov 12 Pre-Release Testers

    @Markus W Why don’t you use the CellLostFocus event instead???

    Thanks. That might work too.

  9. Stephen D

    Nov 12 Pre-Release Testers
    Edited 2 days ago

    @Julian S Put listbox.SetFocus() inside CancelClose so you move focus from the cell to the listbox itself, this also stops this crash happening Feedback Case #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 ;)

    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!

or Sign Up to reply!