general function about keypad