setKeyRepeat function to enabled or disable key repeat.