Forum > macOS / Mac OS X

ShowMessage() runs in a different thread?

(1/3) > >>

JimKueneman:
I am struggling with a bug in my code that I believe occurs because it looks like the ShowMessage dialog is not running in the main thread.  When the dialog is showing (executed from the main thread) I also have a timer running in the main thread that actually continues to tick when the ShowMessage dialog is shown causing me issues.  The expectation was ShowMessage would block the main thread including the timer...  am I missing something here?

Jim

Thaddy:
It is actually the timer that runs in a thread, not the showmessage.
But as long as the showmessage is active, there should not be any screen updates from the timer. That is supposed to be blocked since showmessage is modal.

JimKueneman:
Thanks, that just occurred to me... is this just OS X that does this or does Linux do it as well?  I know Windows has two ways of doing it... on the same thread (message pump) or on a separate thread.

Jim

JimKueneman:
Is there a way to call it in the context of the main thread built in?  If not how would that be done?  PostMessage?

JimKueneman:

--- Quote from: Thaddy on December 28, 2020, 09:04:28 pm ---It is actually the timer that runs in a thread, not the showmessage.
But as long as the showmessage is active, there should not be any screen updates from the timer. That is supposed to be blocked since showmessage is modal.

--- End quote ---

I am setting flags in the timer tick that I am not expecting to be set during the showing of the dialog.

Navigation

[0] Message Index

[#] Next page

Go to full version