When a part is painted, some information is now stored in the game panel. With this information is it possible to get the part id's of the parts which were painted at the current mouse position.
This can be used to find out which part was clicked and therefore which action has to be performed.