This is almost identical to the ```enableSelectMode``` function, so it should be refactored.