>Software types are likely to >cheat and cause their code to break by doing things only when a state is >entered or exitted. AS as "software type", I usually create three states in such cases: One for the "entry" state, one for "polling, looping, etc", and one for the "exit" state. I don't know if *this* is cheating or not, but sometimes the next state to be transitioned to from the current state depends on the previous state. Sort of like subroutine calls within a state machine. I only use such a technique in order to avoid duplication of state. Avoiding duplication also avoids bugs cause by changes made to one of the any identically functioning state but not the rest. I once wrote a state machine for a "game show" program which had over 150 states! Mind blowingly complex, but it would have been almost impossible with traditional logic structures (if then else). State machines rule! Dan > >BillW >