| Custom Controls
 
 Printed From: Codejock Forums
 Category:  Codejock Products
 Forum Name:  Controls
 Forum Description:  Topics Related to Codejock Controls
 URL: http://forum.codejock.com/forum_posts.asp?TID=18058
 Printed Date: 31 October 2025 at 12:28pm
 Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com
 
 
 Topic: Custom Controls
 Posted By: dalai
 Subject: Custom Controls
 Date Posted: 15 March 2011 at 6:09am
 
 
        
          | I opened this for anyone who would like to share their custom controls starting with HH:MM ... 
 class CControlEditHHMMCtrl : public CXTPMaskEditT<CXTPControlEditCtrl>
 {
 public:
 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
 DECLARE_MESSAGE_MAP()
 };
 
 class CControlEditHHMM: public CXTPControlEdit
 {
 DECLARE_XTP_CONTROL(CControlEditHHMM)
 public:
 CXTPControlEditCtrl* CreateEditControl()
 {
 return new CControlEditHHMMCtrl();
 }
 };
 
 BEGIN_MESSAGE_MAP(CControlEditHHMMCtrl, CXTPMaskEditT<CXTPControlEditCtrl>)
 ON_MASKEDIT_REFLECT()
 ON_WM_CREATE()
 END_MESSAGE_MAP()
 
 IMPLEMENT_XTP_CONTROL(CControlEditHHMM, CXTPControlEdit)
 
 int CControlEditHHMMCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
 {
 SetEditMask(_T("00:00"), _T("__:__"), _T("00:00"));
 return CXTPMaskEditT<CXTPControlEditCtrl>::OnCreate(lpCreateStruct);
 }
 
 
 < id="gwProxy" ="">< ="jsCall;" id="jsProxy" ="">
 |  
 
 Replies:
 Posted By: dalai
 Date Posted: 15 March 2011 at 6:36am
 
 
        
          | how do I limit HH to 0-23 and MM to 0-59 ?< id="gwProxy" ="">< ="jsCall;" id="jsProxy" =""> |  
 Posted By: mgampi
 Date Posted: 15 March 2011 at 8:56am
 
 
        
          | Hi; 
 Take a look at boost::regex!
 I solved it this way:
 
 
 | bool CXRTimeCtrl::CheckTime( const CString& strTemp ) const{
 if (strTemp.IsEmpty() && bAllowEmptyTime_)
 return true;
 
 std::string strIn=strTemp;
 static const boost::regex exprFull("^(([0-1][0-9])|([1-2][0-3])):([0-5][0-9]):([0-5][0-9])$");
 static const boost::regex exprReduced("^(([0-1][0-9])|([1-2][0-3])):([0-5][0-9])$");
 boost::smatch what;
 bool bResult=false;
 if (bShowSeconds_)
 bResult=boost::regex_match(strIn, what, exprFull, boost::match_default | boost::match_partial)==true;
 else
 bResult=boost::regex_match(strIn, what, exprReduced, boost::match_default | boost::match_partial)==true;
 bError_= (bResult==false || what[0].matched==false);
 return bResult;
 }
 | 
 
 
 -------------
 Martin
 
 Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
 Platform: Windows 10 v 22H2 (64bit)
 Language: VC++ 2022
 |  
 Posted By: dalai
 Date Posted: 16 March 2011 at 3:00am
 
 
        
          | ok thanks, something like that would be useful in CXTPMaskEdit? instead I handled 
 BOOL CControlEditHHMMSSCtrl::CheckChar(TCHAR& nChar, int nPos)
 
 to check characters
 
 |  
 
 |