Open event causes a stack overflow

I have a SetupScreen method in a module that is triggered by the Open event in my web app. The problem is that the open event is being called over and over again until Xojo has a meltdown and raises a ‘Stack Overflow’ error. My first thought was that there was a recursive call to the open event or a loop somewhere, but there isn’t. The SetupScreen simply does some visual adjustments to the web app by making some items visible and the like. What could make the open event trigger until Xojo raises an error?

Have you tried to comment out the call to SetupScreen, and see if Open still loops ?

Yeah, gone through all of the basics to isolate the problem. What is really confusing is that I have placed 2 label.visible=true instructions in the SetupScreen method that is called by the Open event. All of this is really rudimentary with no trickery or convoluted programming. No wonder I turn to drink.

In Web edition, one of the things to remember is that at Open time, certains things are not properly initialized, and some controls may not exist yet. Your labels visible=True may simply not exist, hence the kaboom. Try calling SetupScreen from Shown instead. Chances are the bug will go.

Yep, the open event was the culprit. Makes one wonder what usefulness the open event actually has if the app has a conniption if you put some code in it

depends on WHAT code you put in it really
its entirely possible to put code in there that causes a never ending recursion - apparently what you have going on

[quote=189095:@Norman Palardy]depends on WHAT code you put in it really
its entirely possible to put code in there that causes a never ending recursion - apparently what you have going on[/quote]

Nothing recursive label1.visible=true is about it. With no commands in the event all is OK, but as soon as I placed a simple command to make a label visible…phfffft. up she goes in smoke. BTW, the label is a standard, off the shel web label with no mods or styles added.

In app.open ?
There’s no session at that point so the runtime probably has to create one, as the app is starting, which probably leads you way off in the weeds

In a web app you should probably not try & do ANYTHING related to UI in app.open as that should be in a session (which is roughly a user connecting to your app from a browser)