I often need to have modal dialogs for editing properties or application configuration settings, but I'm never really happy about how to validate these, and present the validation results to the user.
Choices and tools are typically:-
Design UI so that invalid choices are simply impossible - i.e. use "mask edits", range limits on spin-edits,
Try and trap errors as they're found - immediate dialogs or feedback when a user has an invalid value entered somewhere (although, because this may be due to an incomplete entry, this can be visually distracting)
Detect errors on change of control focus
Validate entire dialog when OK is pressed, and present message box(es) showing what's wrong.
No.4 is typically the easiest and quickest to code, but I'm never really happy with it.
What good techniques have you found to handle this?
While this question is fairly generic, an ideal answer would be easily implementable in Delphi for Win32...