code factorization for direction buttons

Signed-off-by: philippe lhardy <philippe@pavilionartlogiciel>