Numeric Edit Control

WEBINAR:
On-Demand

Application Security Testing: An Integral Part of DevOps


In my application I needed an edit control which accepts only numeric numbers. In many science applications this is indispensable, but it is actually not implemented in MS-Visual C/C++. It is not difficult to implement this control and I see that some people implemented it. In my own code, some new features were enriched as error messages and range defines, etc.

Anyhow, my work is in progress...



class CNumEdit : public CEdit
{
public:
 CNumEdit();
 virtual ~CNumEdit();

public:
 enum {VALID = 0x00, OUT_OF_RANGE = 0x01, INVALID_CHAR = 0x02};
 virtual void Verbose(BOOL v);
 virtual BOOL Verbose();
 virtual int IsValid();
 virtual int IsValid(const CString &str);
 virtual void SetValue(float val);
 virtual float GetValue();
 virtual void GetRange(float &max, float &min);
 virtual void SetRange(float max, float min);

protected:
 BOOL m_Verbose;
 float m_Delta, m_MinValue, m_MaxValue;

 //{{AFX_MSG(CNumEdit)
 afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
 //}}AFX_MSG
}


Download demo project - 32 KB



Comments

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • IT planners have far more options as to where to run their workloads than ever before. On-premises data centers, co-location facilities and managed services providers are now joined by hybrid multi-clouds – a combination of Software-, Infrastructure- and Platform-as-a-Service (SaaS, IaaS, and PaaS) execution venues. All have unique operational, performance and economic characteristics that need to be considered when deploying workloads. Submit the form to watch this webinar replay featuring 451 …

  • A leading provider of tools and services to the health care industry was looking to implement automated chargeback reports with aggregation of tiered storage usage across multiple business units and applications. When the company's storage administrators attempted to create this system in-house, their productivity took a huge hit and they discovered the task was too challenging, as well. Read this case study to learn how this company was able to increase storage utilization, reduce storage consumption, and …

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date