Note that this is very dangerous. As soon as the outer procedure is exited, the procedural variable (which is the generic term for what you call an event handler) will become invalid. The reason is a nested procedure has access to the context of the outer procedure, and when the outer procedure exits this context gets destroyed (and hence becomes invalid).