Have you tried programmatically setting focus to the main form after the callback?
[/quote]
I have tried Mainform.setfocus without success, is there some other command I can use?
[/quote]
It's hard to help because I don't know what you are doing exactly.
[/quote]
I realize that.
I use AudioQueue service from OS X to capture microphone input.
The audioQueue service delivers the data in its own internal buffer in a callBack procedure which is called when a buffer is full.
In the callback, I stop the Queue, I move the captured bytes to a globally declared variable to make it accessible to the main form(thread).
To inform the mainform that the chart can be drawn I set a tcheckbox to true (In the CallBack). In the tcheckbox.change event I call a fft on the data, do some calculations, etc. and finally draw the chart with tlineseries.addxy .
As I said this is working fine in Windows where I use WaveIn which also use a CallBack.
It seems OS X is different!
I have seen in the console that After I called AudioQueuStop and exit the callback, there are still instructions that are executed parrallel to the instructions in the mainform. This mean the AudioQueue thread is still active doing some work.
Maybe I should try AudioQueueDispose which should close the thread. Preferably I would call that only at program closure,but I will make a test and see the outcome.
Thanks all for the help.
Edit: Dispose Queue did not change anything.
Application.processmessages produce a crash