UnsupportedOperationException - embedding WebContainer into a web container - grid for a game

Xojo 2020r2.1 on Windows 10 for Web App

I get an UnsupportedOperationException error and the error message of “Each WebContainer instance may only be embedded once.”

Here is the screen grab of the code:

Any insight would be helpful.
Thanks!

I have a single instance of cc manually placed in the top left corner of the WebContainerControl so to avoid the screwed-up placement that WebContainerControls get when they get embedded via code. That’s why the first block of code checking if I am on the first row.

gg1 is already on the page and you’re trying to embed it again?

I am trying to embed dd1. Maybe that is where I screwed up.

Pass the right parameter!

not gg1, but maybe dd1

What is me?

Perhaps you want w1.gg1.embedwithin(self…
?

YUP. I messed up, it should indeed be dd1.EmbedWithin…

Thanks, my Ritalin apparently is NOT curing my COVID fog completely. :cry:

1 Like

FWIW, the message on the exception should tell you what was wrong.

Of course the error does explain, but sometimes a person’s brain skips over some things. :woman_shrugging:

It would be neat if the error was contextual, as in “The WebContainer gg1 may only be embedded once.” But I can understand it would be a LOT more code to have errors be contextual.