Dynamically creating controls (buttons) and methods for responding to events