|Anonymous | Login | Signup for a new account||2019-05-25 16:23 CEST|
|Main | My View | View Issues | Change Log | Roadmap | Docs|
|Viewing Issue Simple Details|
|ID||Category||Severity||Reproducibility||Date Submitted||Last Update|
|0006424||[JEDI VCL] 00 JVCL Components||major||always||2015-07-28 15:41||2019-04-26 20:34|
|Summary||0006424: TJvValidateEdit only enforces min/max if losing focus|
TJvValidateEdit performs its min and max value validation as part of its FocusKilled (WM_KILLFOCUS) handler. However, as explained by Raymond Chen in http://blogs.msdn.com/b/oldnewthing/archive/2004/04/19/115912.aspx, [^] this is the wrong place to do validation. In particular, pressing Enter to close a dialog with an OK button never triggers FocusKilled, so TJvValidateEdit.Value can have an invalid value if it's read during the OK button's Click event.
The best fix I can think of is for reading the Value property to trigger the same canonicalize-and-validate logic that FocusKilled does. This should only happen during normal runtime, so I believe this should only be done if ComponentState does not include csDesigning or csWriting.
Does this sound reasonable? Are there potential issues or complications that I'm missing? If so, I can submit a pull request.
|Tags||No tags attached.|
|Attached Files||JvValidateEdit.zip [^] (4,995 bytes) 2015-09-14 22:14|
|Please provide the zipped sources of a sample application showing this|
1. Run the attached sample application.
2. Click the Test button to open the modal dialog.
3. Enter a value of -1, which is below the configured MinValue of 0.
4. *Click* the OK button. Note that the message box displays the correctly enforced minimum value of 0, and the edit is set back to 0.
5. Click the Test button again to reopen the modal dialog.
6. Reenter a value of -1.
7. Without clicking anywhere or changing the keyboard focus, *press Enter* to activate the default OK button. Note that the message box displays an invalid value of -1, although the edit is set back to 0.
|I'd say your description and how you plan to fix it is worth a try! Please create that pull request suggested!|
|2015-07-28 15:41||jkelley||New Issue|
|2015-09-14 11:27||obones||Note Added: 0021196|
|2015-09-14 11:27||obones||Status||new => feedback|
|2015-09-14 22:14||jkelley||File Added: JvValidateEdit.zip|
|2015-09-14 22:16||jkelley||Note Added: 0021207|
|2015-09-15 09:30||obones||Status||feedback => acknowledged|
|2019-04-26 20:34||mh||Note Added: 0021753|
|Mantis 1.1.6[^] Copyright © 2000 - 2008 Mantis Group|