Calc Form controls stop working when sheet is de-activated. Why?

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

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.

I confirm this bug. If we use addTextListener when we change active sheet, we lost listener.

But, if we used registerScriptEvent, work fine.

Should a bug report be created for this? Or is this behaviour by design?

I can’t imagine a reason for normal behavior. I think it’s a bug.

Please never hesitate to file bugs for anything you suspect to be abnormal. I know, some people advise to discuss, and looks for duplicates, and do this, and do that … which IMO is absolutely wrong, and only leads to frustration and reduced enthusiasm for bug filing. File it: you won’t waste time searching in the huge database of existing bugs, where people like myself are much more comfortable finding duplicates; if it is not a bug, it gets closed with explanation, and becomes a nice anchoring point for similar questions; if it is a duplicate, it eventually gets marked as such, and this way, increases weight of the original report; and if it is not a dupe, it gets filed - so gets known to the developers.


1 Like

Bug report created 159134.