Hi,
I'm a new user and had just the same problem. On top, the source editor didn't get the focus back when I compiled and ran my source code, so I always had to click into the source editor once to activate it, which can become a bit annoying if you often change the code and want to see what it does at runtime. I noticed that this topic is quite old but as I didnt find any other topic offering a solution, I'd like to add what I found.
For users using manual or anchor-docking, the steps mentioned in this posting here could solve this problem:
http://forum.lazarus.freepascal.org/index.php?topic=9970.0But first, try this: enter the 'Tools' menu, chose the 'Options' menu point and then, navigate to Environment. Then, pick the 'Messages Windows' list point. Now, check the 'Focus messages at compilation' entry. If it's active, deactivate it and click on 'OK'. Now, hit F9 to run your program. Afterwards, the source editor window should get the focus back after compiling / running, as it should be.
Greetings,
Fritz