How to Help Your Business Become an AI Early Adopter
In a project that I am working with about 6 people, we were using spin controls and edit controls to allow the operator to change certain values. We decided we needed one way to handle invalid data typed in the edit control by the operator. The best solution we came up with was to sub-class CEdit, and validate the operators key-strokes.
- Ensure that the edit control has the number only style set to TRUE.
- Then you need to include the "CRangeEdit.h" in your dialog definition file, and declare CRangeEdit member variables for each edit control that you need to check the range of an operators input.
- Then you must set the range the CRangeEdit will accept from the operator, using the CRangeEdit::SetRange() method. The CRangeEdit will default to 0-100 range.
- Set the default contents of the control using CWnd::SetWindowText().
You should be ready to go!