webcontainer and webthread

Is there anyway i can use a thread in a web container, if I try i get a cast error.

Could you show your code?

Had Xojo open, confirmed this real quick.

[code]Unhandled IllegalCastException
Message: ContainerControl1.ContainerControl1 cannot be cast to WebPage

Stack:
rbframework.dylib$1752
RuntimeCheckCast
ContainerControl1.ContainerControl1.Constructor%%o<ContainerControl1.ContainerControl1>
ContainerControl1.ContainerControl1.!_Create%o<ContainerControl1.ContainerControl1>%s
WebPage1.WebPage1.Constructor%%o<WebPage1.WebPage1>
Session.Session.WebPage1%o<WebPage1.WebPage1>%o<Session.Session>
App.DefaultPage%o%o
WebSession._ExecuteEvent%%osA1v&b
WebSession._HandleEvent%%oso<_HTTPServer.HTTPRequestContext>
WebSession._HandleRequest%i4%oso<_HTTPServer.HTTPRequestContext>
WebApplication._HandleHTTPRequest%%oo<_HTTPServer.HTTPRequestContext>
_HTTPServer.HTTPRequestThread.Event_Run%%o<_HTTPServer.HTTPRequestThread>
rbframework.dylib$1221
rbframework.dylib$1016[/code]

<https://xojo.com/issue/46179>

Is the super Thread or Is it WebThread?

To answer your original question though, you could implement it in code.

I wasn’t clear. You can’t drag anything onto a webpage, webcontainer or webdialog that does not inherit from webcontrol. Make a property of type WebThread and you’ll have better luck.

I just ran into the same issue.

  • I have a WebThread on my Page that shows at the bottom pf the page that works.
  • If I move it to a WebContainer that is placed on the Page I get an IllegalCastException when Page.Show runs.

I just ran into the same issue when putting a thread (super thread/webthread) in a WebDialog. Is there anyway to work around before a new Xojo release?

Add the thread as a property instead of placing it directly on the page. Use AddHandler to connect the Run event to a message on the dialog and make sure you call RemoveHandler in the Run method as soon as you’re confident that you won’t need it again. (Just before you call the dialog’s Close method will do.)