A common method for dealing with this is keeping track of state. At program startup, you are in RUN mode. First button press -> EDIT mode, second button press ->CONFIG mode, 4th button press back to RUN mode, etc.
You can also google Finite State Machine to learn all about it.