I am putting together an example to demonstrate building a form from python.
The example automatically creates control and adds them to the spreadsheet.
Event listeners are added to the form controls.
Everything works fine until I select another sheet and then go back to the sheet that has the form controls.
Many of form control events no longer work. I even tried reattaching the events but no luck.
Interestingly some events still work such as property events using XPropertyChangeListener and spin events using XSpinListener
Other listeners such as XItemListener and XTextListener stop working after sheet regains focus.
The example is here and the source code can be see in build_form.py.
Why do the event listeners stop working?
Also, I noticed when that sheet with form controls looses and regains focus that the control models are un-set (None).
I managed this in OooDev by capturing the Model and restoring when missing.