TCustomForm.ActiveControl fires DoExit before form is shown at programstart
Original Reporter info from Mantis: Bart @flyingsheep
-
Reporter name: Bart Broersma
Original Reporter info from Mantis: Bart @flyingsheep
- Reporter name: Bart Broersma
Description:
A TWinControl (or as far as I tested: TMemo, TEdit, TButton) that is the ActivControl on a form fires it's DoExit procedure at startup of the program, before the form is shown.
Steps to reproduce:
Place a TWinControl on a form
In it's OnExit event do "something" (e.g. DebugLn('OnExit'); {needs LCLProc))
Compile, run
The "something" will be performed before the form is shown.
This is not the case in Delphi, so I consider this bug.
Additional information:
Somewhere in the process from creating the form to actually displaying it, it seems that the ActiveControl gets the WMKillFocus message. Why, is unclear to me.
This is potentially harmful if in the OnExitEvent of the control an exception can be raised (as is the case in TMaskEdit). In that case, the form will never be shown (and on Windows the user will not see the output the default exceptionhandler, because most of the times Windows apps are comoile as WinGUI).
I have only tested this on Win9x as of yet.
Mantis conversion info:
- Mantis ID: 12877
- OS: WinMe
- OS Build: MS
- Build: 17968
- Platform: i386
- Version: 0.9.27 (SVN)
- Fixed in version: 0.9.29 (SVN)
- Fixed in revision: 25255 (#02548752)
- Monitored by: » LesKaye (Leslie Kaye)
- Target version: 1.0.0
- LazTarget: 1.0