Cancel button in Delphi VCL to over-ride default action in program
Posted on 2013-10-04
I have OnExit actions on many window components, as the user works through the screen.
However, if users want to stop processing, and they click on the cancel button or the exit button, the action of that button won't take place until the users get to a field that has no OnExit event (or similar). In this case the users have to keep clicking until they get the required response.
I have worked out a solution that seems to work, which is make the OnExit events indirect, by using a timer event to delay the execution of these OnExit events, which lets the Cancel button get the first action (and therefore lets me set a StopProcessing flag).
Is that the standard approach, or is there a better solution?