onShow event not (conditionally) triggered

Hi

I would like to share a behavior of the onShow which is very critical in my opinion and may lead to serious errors (it did in our case).

Prerequisites:

  • Any given form with an onLoad method containing the stmt foundset.clearFoundSet();
  • The above form with an onShow method attached (containing of course some stmts

Result:
The onShow method is NOT triggered, because the foundset is empty! (The table actually contains records)

That means:

  • The onShow method is implicit conditionally executed - depending whether the foundset is empty or not!
  • If one uses the firstShow parameter, obviously the code in onShow is actually never executed.
  • Isn’t this VERY dangerous, as one does not think of event hooks being dependent on any condition like the above described?

I did not test the behavior on forms with no table associated.

Regards, Robert

PS: It seems that foundset.clearFoundSet() is superseded by foundset.clear(), although foundset.clearFoundSet() does not appear as deprecated in Servoy Developer

PS2: foundset.clear shows the same behavior as foundset.clearFoundSet()

It seems to work correct here.

If you can create a sample solution that reproduces this, please create a case about this in the Support System and attach that solution.

Hi Joas

I should also have noted our system config:

Servoy 5.1.4
Java 1.6.0_17
Mac OS X 10.6.4

Regards, Robert

Joas:
It seems to work correct here.

If you can create a sample solution that reproduces this, please create a case about this in the Support System and attach that solution.

Please add that info to your case as well. I tested it on windows, so it might be a mac-only problem.

I also hope some more developers comment on this.

Joas:
Please add that info to your case as well. I tested it on windows, so it might be a mac-only problem.

Robert,

Did you make a case for this? What was the result?

We are experiencing a problem that resembles yours.
Given a tbl-form and a dtl-form based on the same foundset we have a find-button that (when the tbl is shown) shows the dtl-form and puts this form in find modus. In this case the onShow-event of the dtl-form is not triggered.If however we put application.updateUI(1000) between showing the dtl-form and putting it in find modus (controller.find()) the onShow event is triggered!

We are using Servoy 5.2.7 on windows.

so you do:

controller.show()
controller.find()

problem with this is that show could be executed later (its really done when it is really shown and that happens only after your code ends),
and then find is effective, and in find we don’t execute script (only if there is a reference to controller.search or in 6 you have @allowinfind annotation in the doc of that method)

Hi Michel

Your description sounds quite familiar to me.
I checked and I did not make a case (I seem to have forgotten that). I tried to reproduce it and the problem does not appear in a simple case, i. e. just a form based on a table. We don’t exactly remember here where it occured (unfortunatly), but we are quite sure it appeared in a module. And, with quite a big chance, some other relevant conditions in place.

For the moment I can’t add a reproducable example, sorry, but I hope Servoy can correct the behaviour with your help.

Best regards,

michel:
Robert,

Did you make a case for this? What was the result?

We are experiencing a problem that resembles yours.
Given a tbl-form and a dtl-form based on the same foundset we have a find-button that (when the tbl is shown) shows the dtl-form and puts this form in find modus. In this case the onShow-event of the dtl-form is not triggered.If however we put application.updateUI(1000) between showing the dtl-form and putting it in find modus (controller.find()) the onShow event is triggered!

We are using Servoy 5.2.7 on windows.

Our problem is exactly what Johan outlined.

Result is that the onShow-method is not executed and worse the code in the firstShow-part of this method will never be executed.

For now forcing the show to happen before the controller is set to find using application.updateUI(500) is good enough for us.