I am not seeing a correlation.
Sorry for the messy lost_focus. I wanted you to see the debugging.
Because this is OooDev the callback event contains a control class that also includes the control shape. The control Anchor is the cell the control is in (‘B2’ in this case).
def lost_focus(src: Any, event: EventArgs, control_src: FormCtlTextField):
print("Lost Focus")
fe = cast("FocusEvent", event.event_data)
print("Temporary", fe.Temporary)
# print("Source", fe.Source) # source control
print("FocusFlags", fe.FocusFlags)
# print("NextFocus", fe.NextFocus) # next control, same XWindow as Sheet
if not fe.Temporary and not fe.NextFocus is None:
next_rect = cast("Rectangle", fe.NextFocus.PosSize)
curr_rect = cast("Rectangle", fe.Source.PosSize)
print("NextFocus.PosSize", f"{next_rect.X}, {next_rect.Y}, {next_rect.Width}, {next_rect.Height}")
print("Source.PosSize", f"{curr_rect.X}, {curr_rect.Y}, {curr_rect.Width}, {curr_rect.Height}")
x_cell = cast("SheetCell", control_src.control_shape.Anchor)
sz = x_cell.Size
pos = x_cell.Position
print("Cell PosSize", f"{pos.X}, {pos.Y}, {sz.Width}, {sz.Height}")
shape_sz = control_src.control_shape.getSize()
shape_pos = control_src.control_shape.getPosition()
print("Shape PosSize", f"{shape_pos.X}, {shape_pos.Y}, {shape_sz.Width}, {shape_sz.Height}")
Control Right clicks (shows built in popup menu):
Lost Focus
Temporary False
FocusFlags 0
NextFocus.PosSize 209, 201, 230, 168
Source.PosSize 82, 17, 83, 18
Cell PosSize 2258, 452, 2259, 452
Shape PosSize 2258, 452, 2259, 452
Lost Focus
Temporary False
FocusFlags 0
NextFocus.PosSize 233, 198, 230, 168
Source.PosSize 82, 17, 83, 18
Cell PosSize 2258, 452, 2259, 452
Shape PosSize 2258, 452, 2259, 452
Non Control click ( other side of spreadsheet ):
Lost Focus
Temporary False
FocusFlags 0
NextFocus.PosSize 33, 19, 939, 417
Source.PosSize 82, 17, 83, 18
Cell PosSize 2258, 452, 2259, 452
Shape PosSize 2258, 452, 2259, 452