Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CMFCPropertyGridProperty numeric input

I'm using MFC feature pack and I have a dockable properties window. How do I restrict the user from typing any other characters but numbers alone in the values field?

Thanks...

like image 635
Owen Avatar asked Oct 20 '25 14:10

Owen


1 Answers

One of the constructors for the CMFCPropertyGridProperty class has a parameter lpszValidChars which you can use to limit the characters that can be input. e.g.

CMFCPropertyGridProperty* pProp = new CMFCPropertyGridProperty(_T("Numeric Value"),
        (_variant_t) 250l, _T("A numeric value"), NULL, NULL, NULL, 
        _T("0123456789"));

The last parameter here limits the characters that can be entered.

like image 51
Steve Beedie Avatar answered Oct 23 '25 04:10

Steve Beedie



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!