Detecting Third button press

Did you write the code you posted ?