Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
RegisterCallBack
#1
I'm struggling to get my callback to work each time a page is loaded. It always works the first time I create the page, but the callback does not work if I make the page a second time.

In my HTML I have a script to call a function when the page loading has completed.

[font=Consolas, "Courier New", monospace]    <script defer>
        ajaxCall("pageLoadedEvent", "");
    </script>[/font]


In my application I register the callback in the form's OnCreate

WebApplication->RegisterCallBack("pageLoadedEvent", PageLoadedEvent);

The function PageLoadedEvent is called when the page has loaded. However, if I release this form and then create it again (e.g. return to login page and then login again), the callback does not work.

I've tried using the UnregisterCallback n the form's OnDestroy

WebApplication->UnregisterCallback(PageLoadedEvent);

but it doesn't seem to make any difference.

If I have the ServerController's RestartExpiredSession = true, the PageLoadedEvent can be called for a form that no longer exists, i.e. a previous form that has now been released. This crashes my application. 

If I have the ServerController's RestartExpiredSession = false, the PageLoadedEvent isn't called when I make the form for a second time. 

I'm using an old version of IW (15.0.17) as I can't upgrade until I can remove all the CGDevTools from my application.

If there's not way to fix this in the version of IW I am using, I'd be happy with a way of releasing the form, such that when I recreate it, I can register the callback to the new form.

Thanks,
Richard
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)