I would probably make whatever happens on the key into a function, and inside that do whatever until you detect it is no longer pressed. Say for example you turn on a light, just doing that multiple times won't turn the light off. So more like:
void button4pressed ()
{
// turn light on
while (kpd.getKey() == '4')
{} // wait for release
// turn light off
} // end of button4pressed