Strange Delay on Webpage Launch

I have an app and I am having a strange delay after a Webpage launch. I have a login screen and after authentication I can see when the login screen executes a .SHOW to launch the new Webpage by adding a MsgBox right before the .SHOW.

Almost every time the new Webpage appears it is not responsive for sometimes up to 20 seconds. I have placed a MsgBox in the SHOW event of this new Webpage and although the page paints almost instantly the message box in the SHOW event does not appear until after this mysterious delay.

If I logout of the app it returns to the login authentication screen (but the app does not end). If I login again the mysterious delay never appears. If I kill the app and relaunch it the delay appears again for the first time.

If I wait for 20+ seconds before I authenticate on the very first launch screen then login it seems the delay does not appear (or something has already timed out).

Just to make it more weird I can login a slightly different way as a different user type and it launches to a different Webpage and no delay appears.

This is all in the XOJO IDE on OSX. I have not yet tried it on my “real” Linux Web server.

I have not used the debug features in XOJO. Could that help track down where the delay is happening?

Any hints on how to debug would be appreciated.

Tough to say. You probably want to check your Open event handlers to see if they have any code that could cause such a delay.

Definitely use the debugger and set breakpoints to watch the code execute.

You can also use System.DebugLog to log messages to the Messages pane in the bottom of the IDE, which is more reliable than using MsgBox.

Paul,

SOME PROGRESS

Thanks for the System.DebugLog tip. I am not sure why I overlooked using that feature. The MsgBox solution was messy and interrupts the flow of a screen and control focus. But worse you could not see time stamped messages in one place. To borrow a word from Homer Simpson … “Doh”.

I am using the ChartDirector class from Monkey Bread Software and events are firing at times that I did not expect. I have not nailed it down yet but I can see from the DebugLog that the SHOWN event fires unexpectedly and more than once. ChartDirector does take a second or two for rendering some types of charts. I am guessing that calling it multiple times may be the issue.

I have three containers hidden and disabled. I ENABLE and SHOW them when I want one visible. It seems some events are firing even when NOT ENABLED.

I have repurposed some code from a different part of this app that I wrote some months ago and I think my rework is not functioning as expected.

Just keep saying “I love event driven system debugging … I love event driven system debugging …”.

More work needed and thanks for the help.

I have noticed that the Shown event for each container fires when the page is first loaded. I now put only one container with a chart on a page.

You could also turn on profiling. I find that extremely useful for tracking down things like this.