onFocusGained problem

Hello,

we have a method attached to onFocusGained. The method does all kinds of stuff and requests the focus of the field it was fired from passing the false argument at last. This worked great in Servoy 2. In Servoy 3.1 it ends in an endless firing of the method.

I have figured out that this only happens when you call a controller.saveData() in the method. This is needed and did work as expected in Servoy 2. This code

application.output((new Date).getTime() + ' method called');
controller.saveData();
elements.test_focus.requestFocus(false);

should allow to reproduce the problem easily. There will be loads of output. This is very annoying. Can this be fixed?

Thanks
Patrick

fixed in the next version.

:)

The above sounds VERY familiar to the situation I find myself in right now, and I’m using version 3.5 so it should be fixed according to the above. I’m upgrading to 3.5 from 2.2.7 and having MASSIVE onFocusGained/OnDataChange problems in a working solution from 2.2.7.

For one, it fires OnDataChange whether the data has been changed or not – not every time, just about the fifth time I click in a field with this property (between 5 and 10). If debugger is on and I’m in formindialog, Servoy Developer crashes making this extra fun to test.

For the other, if I have a controller.saveData() in the onFocusGained method I get extra special freezing/crashing – or more rightly called looping, like it builds up referring to itself and eventually I can’t gain focus on anything new.

As you can probably tell, my 2.2.7 solution was using both onFocusGained and onDataChange properties on one field in multiple rows, all of which is in a tabpanel on a formindialog. Therefore, these bugs are stacked on top of each other so I’ve had no luck getting you anything concrete through the bug tracking submission database. Isn’t anyone else having this trouble with OnDataChange or OnFocusGained who isn’t quite so mired in complex debugging?

I would understand if this was too much for servoy in general – what I’m doing is insane, but it has worked for more than a year in 2.2.7 and because my solution won’t load in Java 1.6 I’m being forced to upgrade.

ellen

This problem is back now in Servoy 3.5.5.

Could this be fixed again, please?

will look into it.

Thanks. Currently I use a workaround by setting a global at the end of the onFocus method. If that global is set, the onFocus method will not do anything but reset the global.

Works, but it’s ugly.