Rabmac is correct.
You can think of it this way, the charger/transformer (either built in computer or as brick on cable or attached to wall socket) can supply X amount of wattage at maximum.
Said wattage goes to laptop. Laptop's first priority is to simply stay up and running (if it is on) and thus it takes however much of that X watts it needs to do so. Charger is usually designed so that it can keep the toy running at full load and have a bit more left to charge it (even if slowly)
Possible problems can be caused by heat though since usually first thing that is turned off when heat gets too high is the battery charging (it generates heat too)
remaining part goes to charge the battery.
in short, the more you use, the less battery charges. This applies to all devices with batteries, including tablets and phones too.