Locked CMFCPropertyGridProperty formatting

  • Friday, May 11, 2012 3:09 PM
     
     

    I've asked this question over in the BCGSoft forums, but things seem to be pretty quiet over there and I thought I'd try here.

    CMFCPropertyGridProperty uses the same format string (eg m_strFormatDouble) for scanning input (::TextToVar) and output formatting (::FormatProperty). This means that a format string that specifies precision, such as _T("%.3lf") for a property of type double (VT_R8), works fine in the CString.Format used for output, but fails in the _stscanf_s used for input in TextToVar. So, as far as I can see, there's no way to format the display of float or double properties, eg to restrict the display to 3 digits after the point.

    Has anybody resolved this problem?

All Replies

  • Saturday, May 12, 2012 9:47 AM
     
     Answered
    I seem to have answered my own question here. I've redefined the TextToVar and FormatProperty functions in a class that inherits from CMFCPropertyGridProperty to do the correct formatting, and all's well now.
  • Monday, May 14, 2012 9:03 AM
    Moderator
     
     

    Hi AndyB123,

    I am gald to hear that you have fixed the issue. And thanks for sharing your experience & solution with us, which is realy very beneficial for other community members who have similar issues.

    Thanks again for your active participation in the MSDN Forum.
    Best regards,


    Helen Zhao [MSFT]
    MSDN Community Support | Feedback to us

  • Friday, May 18, 2012 3:28 PM
     
     
    Can you provide your code? I am fighting the same battle, and would love to borrow from someone who has already made it work!