Detect button presses.