I'm trying to send mails with the above example. Sending the mail works fine. However, with the task the UI shouldn't be frozen. Instead I get the pizza and my progress wheel doesn't show up.
Bug, feature, am I doing something wrong?
Xojo 2016r4, Chilkat plugin from June. Mac OS 10.11.
Mit freundlichen Grüßen/Regards
http://www.mothsoftware.com Mail Archiver X: The email archiving solution for professionals
The purpose of the example isn't that you would copy-and-paste the code verbatim.
The example does the following in sequential order:
Your actual Xojo code would perform each step separately. You would write a Xojo function/subroutine to start the async task, and then return.
Then you would implement some means to periodically check for the task completion. Maybe a timer event? The checking can be quite often (multiple times per second) without noticeably affecting UI performance. When your app notices the task has completed, you then do step 3.
Your app would never do steps 1, 2, and 3 altogether as shown in the example, because (of course) it would freeze the UI because control is not returned to the main event loop..
Sorry, my bad. You know those lazy developers that only do copy and paste.
I had wondered about the code. But since it compiled I tried it. It was the line with dim xxx as task that confused me. This really indicated to me that the task was a local variable and not a property of the window.
The MBS guy converts his examples to html (see http://www.monkeybreadsoftware.net/example-cocoa-nsstatusitem-statusitemwithpopover.shtml for instance) so that it's way easier to see how the code is used.
Follow-up: the root cause of the issue was that I was adding more than a couple of attachments which had to be zipped first. This was causing the spinning pizza of death to show even when the task was used correctly. With a thread and a timer everything now is sent in the background.