Well, you could find what type of unit is being cancelled using a complicated system. Everytime you order a building to train.. say a footman, this is stored in a variable array in the [0] slot, now say you order this building to train a knight, the knight is now stored in the [1] slot, and an integer variable is increased to 1. If the building cancells a unit, it will check what type of unit was most recently stored in the array. You would also have to remove the last stored unit when a building finishes training a unit..
This would be a fairly advanced system to create and I get the feeling wutrus isn't capable of such a thing yet.