Invoking/Executing a function AFTER caller function finished or returned in FMX or System Library


TMessageManager’s ‘SendMessage’ method does NOT invoke the ‘Subscribed’ (or associated callback) function AFTER the function that calls the ‘SendMessage’ is finished.

For a usable solution for this problem, I was thinking about using TTimer with least possible time interval (which is 1 millisecond) so that when you Enable the timer in the caller function, the OnTimer event of TTimer will have to be triggered AFTER the function that Enabled it. I think this is a kind of “slow” and ugly workaround to this problem.

Is there any Application-wide messaging facility in FMX or System Library that can invoke a callback function AFTER the caller function is finished or returned ? (Other application messages processed/invoked between them is also okey) This is for FMX or Multi-Device Cross Platform development by the way. Not specific to VCL or Windows Environment.

(What I really want, is to be able to send a message to the own application similar to the how Windows API function PostMessage behaves. The messages sended by PostMessage appear from windows procedure callback function after PostMessage function is returned.)

Comments are closed.