small code factorization.
fixed bug: slider can no longer be moved after entering 0 in text box.