I’m still moving old code from the RS era to Xojo and threads, but I can’t find an answer to this one - can we pass arguments to a Thread’s Run event. or do we need to set up variables that are then read by the thread. The Developer.Xojo.Com pages are quite sparse on Thread info. In fact, searching for Thread.Run returns nothing.
I’ve tried modifying the default Run event with complete failure.
The simple way is setting a global/app/window scope variable and the execute Thread.Run().
Mod.var = some_value // or
App.var = some_value // or
Win.var = some_value
// and then
You can’t modify the run event - and you don’t call the Event in either case. You can overload the Run method in a subclass.
Sorry, that should have said “method” instead of “event” above. I have subclassed the thread and tried adding the archives to the exposed Run method, but either I get an error on compile or the argument isn’t seen (I’m trying to pass a job-specific array).
That’s what I’m trying to alleviate since I may need to start 10-12 threads, each with its own job information.
[quote=373244:@Tim Jones]I have subclassed the thread and tried adding the archives to the exposed Run method, but either I get an error on compile or the argument isn’t seen (I’m trying to pass a job-specific array).
I’m not seeing that issue. Here’s my test implementation (paste into a .xojo_code file and drag in to the IDE):
Ah - I was creating a new exposed event. I’ll re-create it as a Method. Old subclassing habits die hard
this is a hard-to-find mistake, as the compiler generates no clear error …