onFocusLost is a bit late

Hi guys,

I have a toolbar in my window where I enter data into a field.
The toolbar has a button with an method attached to it (that executes when clicked).
The field has the onFocusLost method that also does important stuff.

Now, if I type in my field and then click on the menu button (‘save’), then onFocusLost is fired AFTER the button method.
The application logic and validations are going in the wrong order this way and that ruins my app. Depending on what I typed in the field, local validations are fired and a search screen might be popped up, eventually ending up in valid input. But if the toolbar button action fires first, it always assumes those checks to have run and therefore complains more than it should or even crashes :)

Tell me it’s a bug and I don’t have to deal with it :wink:

Smart client or web client?
I wonder if it’s related to another case in which the event order is actually correct, but the problem was that even after the modal dialog is open by focus-lost event, the click will still execute (without closing the dialog).

Andrei Costescu:
Smart client or web client?
I wonder if it’s related to another case in which the event order is actually correct, but the problem was that even after the modal dialog is open by focus-lost event, the click will still execute (without closing the dialog).

Smart client, Andrei.
Not sure if those are related, but someone from Servoy would probably know.

The problem I mentioned was like this:

Field focused, modified then a click on a button happened => onFocusLost did execute first (you said it didn’t) - a modal dialog was shown by the onFocusLost but then the action event on the clicked button was triggered (and you might expect the action not to trigger because of the modal being shown before, but it doesn’t work like that). Is it the same for you or in your case is the onFocusLost code actually triggered after the click?

Andrei Costescu:
The problem I mentioned was like this:

Field focused, modified then a click on a button happened => onFocusLost did execute first (you said it didn’t) - a modal dialog was shown by the onFocusLost but then the action event on the clicked button was triggered (and you might expect the action not to trigger because of the modal being shown before, but it doesn’t work like that). Is it the same for you or in your case is the onFocusLost code actually triggered after the click?

In my case onFocusLost does get triggered but after the click on the button, Andrei.
So it goes: field focussed, modified, then click on a button - voila, button action fires, then onFocusLost fires.
It’s worth mentioning that this happens only for toolbar buttons, the ones created with plugins.window.addToolBar(). Normal Servoy buttons don’t play games like that.

maria.kyselova:
In my case onFocusLost does get triggered but after the click on the button, Andrei.
So it goes: field focussed, modified, then click on a button - voila, button action fires, then onFocusLost fires.
It’s worth mentioning that this happens only for toolbar buttons, the ones created with plugins.window.addToolBar(). Normal Servoy buttons don’t play games like that.

I think it’s a bug. You should report this in the support dashboard at Dashboard - Servoy Support

Best, Carlos

jcarlos:

maria.kyselova:
In my case onFocusLost does get triggered but after the click on the button, Andrei.
So it goes: field focussed, modified, then click on a button - voila, button action fires, then onFocusLost fires.
It’s worth mentioning that this happens only for toolbar buttons, the ones created with plugins.window.addToolBar(). Normal Servoy buttons don’t play games like that.

I think it’s a bug. You should report this in the support dashboard at Dashboard - Servoy Support

Best, Carlos

Perhaps I will, Carlos.

It’s something else then. I agree with Carlos.