I'm pretty sure it's because when you click the button and it's 0, event 3 will be true so it adds 1 to ButtonOkClick. Then, since ButtonOkClick == 1, when it gets to event 4 the conditions will be true also. Try flipping them around (Event 3 becomes event 4, event 4 becomes event 3)