If the cell is editable, why not set the property when you load the cell instead of when the user clicks? The combination of changing the cell type and trying to edit it in the CellClick event may be the cause of what you are seeing.
How did you do that? If you are placing a control over the listbox, then when the user clicks on the control, the listbox will lose focus. The order of events might be different than you expected, in that the click gets handled before the focus events. Is that what’s going on?
Should read: I added a SegmentedControl to a Window that has a Listbox and previously this wasn’t happening.
The lost focus happens when I click on a cell in the Listbox. The segmentedcontrol should be enabled only if a listbox has focus, but the listbox loses focus immediately.
It is also that I added the control to the window and this happened. I had pushbuttons before that were enabled if the Listbox had focus.
So. What do I do? I could make ALL the cells editable
I solved my problem sort of. I added back the LostFocus event to the Listbox and that didn’t cause the event to fire.
So I decided to figure out what caused it to fire.
I added first setting a property referencing an control object to Nil and that didn’t cause it to fire.
ObjFoced = Nil
Then I added the segmented control code back and that caused it to fire.
Then I eliminated the segmented control piece of code, and the LostFocus didn’t fire.
Then I added any control with enabled and it fired.
ObjFoced = Nil
InfPostRad.Enabled = False
Then I changed the last piece to a method Objsetter(me) that references an object but not in LostFocus, and LostFocus doesn’t fire.
If me = GrmList Or me = FldTtleListBox Or me = RplcingBox Then
RowsSegments.Items(0).Enabled = True
RowsSegments.Items(1).Enabled = True
ElseIf me = Nil Then
RowsSegments.Items(0).Enabled = False
RowsSegments.Items(1).Enabled = False
End If
My problem is solved. This acts like a bug in XOJO.