I hope I explain this clearly and make it easy to follow.
I have a WebContainer in my page. In this WebContainer the user can configure some things and press a button to create a file.
Pressing the button to create the file will launch a WebDialog (placed inside the webcontainer) by calling WebDialog.show. When I call webdialog.show, there are instructions in the shown event of the dialog to build a file, this includes calling one method of the original WebContainer. This method can take several minutes, and that is why I have placed a cancel button in the shown dialog to cancel the file creation process. This way I can press it and activate a flag (boolean property in the dialog) via the action event.
So, a WebContainer opens a dialog. The dialog pops up with a message that says “creating file” and with a cancel button. The dialog.shown event makes some things and executes a method that belongs to the WebContainer. Inside this Method there is mainly a for loop which is creating the file, but is also checking in each iteration on a boolean flag (property of the dialog) to see if the user cancelled, in which case he exits the loop and aborts creating the file. So the idea is that when the user clicks on the cancel button, the action event should activate this flag and the method which creates the file should abort.
However, it didn’t work as I expected. The action event of the cancel button is not fired until the method exits the for loop (file is already created). This is exactly what I want to avoid, I want to interrupt the loop cause I don’t want to wait for it to finish.
I tried using App.DoEvents but didn’t work. I also thought I could probably use threads, but there aren’t any in WebEdition.
What is the way/best practice for doing something like this? Can someone explain me how RS/Xojo works so that this does not work? or point me out where I can read about it?