a question about state changes

When you ask your questions you should always let us see what you have tried to solve the problem yourself.

As far as the examples in the IDE, treated these examples as nothing more than techniques.

You will never find an example that does exactly what you want.