Can I pop up a dialog box from a thread?

I have a list of files that need processing.
I thought well, maybe I should process them in a threads run event.
But then I realized that for each file I might have to pop up a dialog box and get an response from the user. (Modally)
And then I wondered if i was actually allowed to do anything gui related …

Sub Run() // The event handler of the thread subclass on the main window? dim f as FolderItem while not me.terminated if me.UBound >= 0 f = me.TopElement if f.proptery = something then dim w as new MyDialogBox b=w.showModal Select Case b //determine which button was pressed. Case d.ActionButton //user pressed Save Case d.AlternateActionButton //user pressed Don't Save Case d.CancelButton //user pressed Cancel End select End If End If Wend End Sub

Not sure this will work…

No. You can’t manipulate or create UI from a thread.

Unless the processing of a single file takes a long time, there is not much to be gained by a thread in this instance since you need a response from the user for each file.

Not for every file… no that that would change things though…

I’m not sure what you want to do is a good idea. But, of course, “yes you can”. See http://blog.tempel.org/2013/08/xojo-using-msgbox-from-thread.html , which needs to be adapted to MessageDialog.

It doesn’t take much time… and the interface can ‘block’ for that duration…
Perhaps if i serviced the queue in a timer then in the timer event I can pop up a dialog?
I chose a thread because it seemed like the right thing to do but if you can’t interact with the user from the thread then that ain’t gonna werk.