Stop. All GUI-related activities run from a single thread, but various things generate events which are dequeued by what used to be called the message loop but which in Delphi and Lazarus is generally hidden.
So a keyboard action will generate an event, a mouse action on the application area of a window will generate an event, a window resize request will generate an event, and so on.
In addition, a timer firing will generate an event, and broadly speaking dialogues being opened or manipulated will rely on or result in events... please excuse a bit of handwaving here.
When you display a dialog(ue), including calling ShowMessage(), the created window might be modal or modeless. A modal dialogue generally has to be closed before other activities can continue, but this doesn't necessarily imply that other windows won't respond to events. A modeless window will continue to run in parallel.
If you start a background thread then you CANNOT use any part of the API which manipulates the GUI directly. Broadly speaking, I believe that this limitation is shared by all comparable software.
Delphi and Lazarus (encompassing their class libraries) provide the Synchronise() method that allows a background thread to interact with the GUI, this is synchronous but if you look at the wiki you'll see that tehre are also asynchronous equivalents i.e. which do not block the background thread.
I suggest reviewing what you're doing and your overall understanding in view of that little lot, I've skimped on URLs etc. because of the importance of preventing you from going on a wild goose chase.
MarkMLl