http control done and fail handler functions


Mario Steinbacher

Hello David!

I do have a feature request for the http control element on fast user interactions.

Because fast user interactions by opening a view and going back immediately results in a global Javascript ErrorEvent.

I explain my specific problem:

In my main view I have may buttons to open other views and in some of these other views I have a http control that executes in the show event do load new data. But when the user immediately goes back to the main view before the done event have been fired the event fires on my home screen but there does this http control not exist and so it throws the error.

My solution would be to check if "self" is defined before doing the rest of the function.

best regards

mario


decsoft

Hello Mario,

I am near to understand your point, however, I am not completely sure. Please, let me to explain. Certainly, the situation is like you describe, and, an error occur, however, it's not a fatal error, that is, once the user back to the main view, everything in that view continue working as expected, even the ability to go again to the another view.

So what's the point to check if "self" is defined or not? I mean, if the error occur, your code after the error is not executed, but, nothing else... I supose that you do something if the error did not occur, but, if the error occur, because the user go back to the main view, then you do nothing (because your code is not executed) and then nothing happens...

If you need from the main view that something is well executed in the another view, then you can use a flag variable, so, if the done event of the Http control is well executed, your flag variable is "true", for example, and, if the error occur, that flag variable can be "false" (you can set to "false" when enter the view), so, you can check that flag variable in the main view, so you know if the work is done or not.

Another possible idea is to use the app's ChangeView event, which allows to look what is the next view and the prev view: we can event prevent the user to change to a view from another, for example, until some code has been executed. So please, let me know if all of these can help you and just post here if you want to explain me a bit more about or what to place any questions.



decsoft

Hello Mario,

A bit more about the possible flag variable to be used. Before you made the HTTP call, you can set a flag variable in order to know if the work has been done or not. This variable can be set to "false", for example. In the HTTP control Done event, you can set that flag variable to "true". If no error occur and the user back to the main view, that flag variable is "true". If some error occur, since the Done code is not executed (after the error), then the flag variable is still "false", and you can know if in the main view.

It's just an idea, of course: I am not sure if that can be exactly what you wanted, but, I hope you got the idea. This kind of flag variable can maybe also combined with the app's ViewChange event: if the flag variable is "true", you allow the user to back to the main view from the another one: if the variable is "false", you cancel the navigation to the main view, or do something before if needed.



Mario Steinbacher
Hello David!
Thank you for your tips. and sorry for any inconvinience.
this was just a guess because I have a swiper on my homescreen with buttons on each swiping element. And from time to time (more often then less) the buttons dont work anymore just get focused on click. but after swiping to the next and back the buttons do work again.
the only error I found was my described problem.
But thats not your problem maybe the swiper does something weard.
sorry
and thank you for your awesome work
good night and have a great weekend (if its possible these times)

decsoft

Hello Mario,

Please, no problem nor inconvenience at all! I am happy to help when possible. So don't hesitate to post here everytime you think I (or may other of our mates) can do something for you. Have a nice weekend too (yes... if possible...)!


Everybody can read the DecSoft support forum for learning purposes, however only DecSoft customers can post new threads. Purchase one or more licenses of some DecSoft products in order to give this and other benefits.

This website uses some useful cookies to store your preferences.

I agree. Hide this note. Give me more information.