This error only occurs if the app is run from Xojo IDE, except, of course, when the Project–> Break On Exceptions is not checked, which I don’t want to do because there might be other code errors I could commit.
The mContainer.Close event executes some Javascript code I did not write and I don’t want to dare to comprehend. But I think the script has reference calls to a Xojo object that has long been gone.
Resuming the debugger works fine but I really want to catch this pesky exception.
It doesn’t occur in the demo project for AttyWebJSPanel and usually when there’s a RuntimeException within the framework code the debugger breaks into a view of nothing. You’re seeing a line of code highlighted so I suspect the issue is within Xojo Code somewhere in the project.
Can you supply an example project that replicates the problem?
I didn’t see that in his code. He mentioned the global setting, I’m just pointing out he can do it locally and not skip other exceptions in the debugger.
That may not be the case. If any of the user code that’s called by calling the Close method has an exception (like the Closing event), and the code has other #pragma statements in there, it’s possible the debugger is just skipping over that.
I’ve seen this behavior when devs use BreakOnExceptions in their code and then always turn it back on afterwards regardless of the state it was in before because nested setting of that pragma almost always does the wrong thing. Imagine:
#pragma breakonexceptions false
Try
Do something
#pragma breakonexceptions false
Try
Do something
Catch ex as RuntimeException
Handle exception
End Try
#pragma breakonexceptions true
Do something that raises an exception
Catch ex as OutOfBoundsException
Handle exception
End Try
#pragma breakonexceptions true
This is effectively what could cause the above behavior.
This is why it’s far better to write good code than relying on exception handling for flow.
Hello, Tim. Thanks for the reply. I’m glad that you are familiar with AttyWebJSPanel.
Aside from AttyWebJSPanel, I am also using GraffitiSuite. So, I am not sure if I can include GS with the demo project. Maybe I can include more screenshots or a video clip, if that would help.
Actually, I have countless of AttyWebContainers housing GS controls without problem. Only this particular AttyWebContainer that has GSTabpanel, GSSimpleEditor and GSTree within it. With trial and error, the out of bound exception occurs if I include the GSTabpanel control. However, in my attempt to get a demo project working (only the bare necessities, no data loaded), I could not replicate the problem even with GSTabpanel on board.
Hello, Greg. The container is a part of a WebSDK. Its Close even is under Event Definition (no code) but I think it calls the Closed event handler in its implementation. I may be wrong, though. I’m showing here the code of the Closed event.
Try
//NB: Delegates were added because in the code you can add the event handler to the webcontainer via
//AddHandler on the close event. If that event is set by code for the target screen it cannot be added to the JSPanel close events.
//The result is that there is no other way to close the dialog if the container is closed
If HostControl <> Nil Then
Session.ClosePanels(HostControl.UID)
End If
if fnCloseDialog <> nil then
fnCloseDialog.Invoke
fnCloseDialog = nil
end if
RaiseEvent ClosingConfirmed
RaiseEvent Close
catch e as NilObjectException
catch e as OutOfBoundsException
catch ex as RuntimeException
end try
If it’s related to GraffitiTabPanel, then it’s likely code in the ItemClosed event. Only reasonable thing I can think of without seeing a reproducible example.
You cannot, but you can send me a reproducible example via my support system if you still have an active subscription and I can try to track it down.
Long shot: I have a WebPage that has a WebComboBox on a WebContainer on it. Whenever I went to Show the WebPage (not Close) it gave me an OutOfBounds Exception in the Show command. Turns out I had the IndexValue set to 0 while the Initial text was blank.
This OutOfBounds only showed up recently (I’m on Xojo 2025R1.1) and was easy to fix. Maybe you have the same issue with a WebComboBox or WebPopupMenu but on Close?