The programming you are asking about would be 100% dependent on the model and program capabilities of your specific HMI. If you wanted different sections of code to run on the PLC, based on the page you are viewing, you could use ILOCK and ILOFF functions triggered by a "bit-on when page opens" function. Again, dependent on the HMI you are using.
If you like, I can send you a copy of the program for a Maple Systems touch screen that I'm currently using. E-Mail me if you would like to see it.
Dogface