import "ecere" class AsyncTask : Thread { public void * userData; virtual bool any_object::notifyDone(); void doSomething() { if(!created) Create(); } unsigned int Main() { // Do something here Sleep(3); ((GuiApplication)__thisModule.application).Lock(); notifyDone(userData); ((GuiApplication)__thisModule.application).Unlock(); return 0; } } class Form1 : Window { caption = $"Form1"; background = formColor; borderStyle = sizable; hasMaximize = true; hasMinimize = true; hasClose = true; clientSize = { 632, 438 }; FontResource doneFont { "Arial", 24, bold = true, window = this }; bool done; AsyncTask task { userData = this; bool notifyDone() { done = true; Update(null); return true; } }; void OnRedraw(Surface surface) { if(done) { surface.font = doneFont.font; surface.WriteTextf(50, 50, $"Done."); } } Button button1 { this, caption = $"Do Something", position = { 328, 136 }; bool NotifyClicked(Button button, int x, int y, Modifiers mods) { task.doSomething(); return true; } }; } Form1 form1 {};