Closing app while in editcell mode

I recently ran across a situation where if the user is editing a cell in a listbox and clicks the app’s close box, the app generates a runtime error. To get around the problem (in an admittedly ugly fashion), in the window’s Close handler I force a different control to get the focus. By doing this, the edits in the cell are lost, as they should be, and the runtime error is circumvented.

My question is this: is this really the best way to handle it or is there a “proper” approach?

Thanks.

BTW, if it makes any difference, I’m running 2018r3 on a Windows 10 system.

  1. abort the close (CancelClose) if activeCell
  2. or in Cancel close … force completion of the edit

either should avoid a run-time error

[quote=416303:@Dale Arends]I recently ran across a situation where if the user is editing a cell in a listbox and clicks the app’s close box, the app generates a runtime error. To get around the problem (in an admittedly ugly fashion), in the window’s Close handler I force a different control to get the focus. By doing this, the edits in the cell are lost, as they should be, and the runtime error is circumvented.

My question is this: is this really the best way to handle it or is there a “proper” approach?

Thanks.

BTW, if it makes any difference, I’m running 2018r3 on a Windows 10 system.[/quote]
Could you post the text that’s in the Runtime Error dialog?

[code]Runtime Error
Press OK to Continue
Press Cancel to Quit.

Please report what caused this error
along with the information below.

Universal\REALstring.cpp: 130
Failure Condition: usageCount[/code]

Its a known bug from June <https://xojo.com/issue/52488> I just do a listbox.SetFocus() inside CancelClose

Yeah, that’s what I wound up doing.