Listbox getting stuck on opening because of EditCellAt

I understand why during opening of the window tt gets stuck - because I called for EditCellAt during a method (Fill) which fills the Listbox and then gets called again in CellGotFocus. The last call for some reason then goes to CellLostFocus. It then cycles through Got and Lost.
What I don’t understand is why it gets stuck.

Edit: If I remove only the call during Fill. it still gets stuck.
If I leave in that call, but remove the call in CellGotFocus, I have no problems at all.

Would have to see some code, but at first blush is sounds like a bad design. Focus events are not a good place to put any kind of processing or logic. What are you trying to achieve?

Just guessing here, but if you want to fill the listbox, give it focus and then open the first cell for editing, one trick is to use a short-period timer to call EditCellAt.

I am trying to make it simple to get a call for EditCellAt while I move about the Listbox.

I guess I’ll do it during CellKeyDown and CellClick.

If you’re doing this all in window.Open, the listbox will get filled, EditCellAt will open the cell, and then as soon as finishes, the first control on the window will be given focus, which removes focus from the cell and triggers CellLostFocus, which puts you into your loop.

Yes. I do it all in those events. Focus events get very tricky.

Thanks for confirming. Sigh.