login about faq

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

Beatrix Willius

http://www.mothsoftware.com Mail Archiver X: The email archiving solution for professionals

asked Dec 07 '16 at 04:21

bwill's gravatar image

bwill
3516

edited Dec 07 '16 at 04:23


The purpose of the example isn't that you would copy-and-paste the code verbatim.

The example does the following in sequential order:

  1. Starts the async task to send the email.
  2. Waits for it to complete.
  3. Examines the results after the task completed.

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..

link

answered Dec 07 '16 at 11:19

chilkat's gravatar image

chilkat ♦♦
12.8k318396560

edited Dec 07 '16 at 11:19

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.

Regards

Beatrix Willius

link

answered Dec 07 '16 at 13:04

bwill's gravatar image

bwill
3516

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.

link

answered Mar 03 '17 at 08:52

bwill's gravatar image

bwill
3516

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×89
×23

Asked: Dec 07 '16 at 04:21

Seen: 1,180 times

Last updated: Mar 03 '17 at 08:52

powered by OSQA