Print Page | Close Window

About Hex value in property grid.

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Property Grid
Forum Description: Topics Related to Codejock Property Grid
URL: http://forum.codejock.com/forum_posts.asp?TID=3601
Printed Date: 28 April 2024 at 1:50pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: About Hex value in property grid.
Posted By: dubaoan
Subject: About Hex value in property grid.
Date Posted: 05 February 2006 at 1:05am

Hi, all,

    Would you please tell me whether CXTPPropertyGridItemNumber supports display and acceptance of the hex value? And if not, how can I realize that? 

    Is there any ways other than using 'SetMask' ?

    Thanks!




Replies:
Posted By: Oleg
Date Posted: 05 February 2006 at 4:50am

Hi,

Here custom class:

class CXTPPropertyGridItemHexNumber : public CXTPPropertyGridItemNumber
{
public:
 CXTPPropertyGridItemHexNumber(const CString& strCaption, long nValue = 0)
  : CXTPPropertyGridItemNumber(strCaption, nValue)
 {
  SetNumber(nValue);
 }

 void SetValue(CString strValue)
 {
  int nValue = 0;
  if (_stscanf(strValue, _T("%x"), &nValue) == 1)
  { 
   SetNumber(nValue);
  }
 }
 
 void SetNumber(long nValue)
 {
  m_nValue = nValue;
  
  if (m_pBindNumber)
  {
   *m_pBindNumber = m_nValue;
  }
  
  CString strValue;
  strValue.Format(_T("%x"), nValue);
  CXTPPropertyGridItem::SetValue(strValue);
 }
};



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: dubaoan
Date Posted: 05 February 2006 at 7:04pm
Thanks!!!



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net