Print Page | Close Window

[Closed] CXTPControlEdit - Numeric

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=7358
Printed Date: 21 November 2024 at 4:12pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: [Closed] CXTPControlEdit - Numeric
Posted By: Simon HB9DRV
Subject: [Closed] CXTPControlEdit - Numeric
Date Posted: 11 June 2007 at 1:09pm
Hi,
 
How do I make a CXTPControlEdit have the ES_NUMBER style? I've tried many options, got nowhere.


-------------
Simon HB9DRV



Replies:
Posted By: Oleg
Date Posted: 12 June 2007 at 2:35am
Hi,
Call pControl->SetEditStyle(ES_NUMBER);


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


Posted By: Simon HB9DRV
Date Posted: 12 June 2007 at 2:51am
Just tried this in the CommandBarControls sample:
CXTPToolBar* pToolBarEdit = pCommandBars->Add(_T("Edit"), xtpBarTop);
 pToolBarEdit->SetBarID(IDR_MAINFRAME + 4);
 pToolBarEdit->GetControls()->Add(xtpControlLabel, 0)->SetCaption(_T("CXTPControlEdit:"));
CXTPControlEdit* pControlEdit = (CXTPControlEdit*)pToolBarEdit->GetControls()->Add(xtpControlEdit, ID_FILE_NEW);
pControlEdit->ShowSpinButtons(TRUE);
pControlEdit->SetEditStyle(ES_NUMBER);

Doesn't work  I can still enter non-numeric.


-------------
Simon HB9DRV


Posted By: Simon HB9DRV
Date Posted: 12 June 2007 at 2:53am
Also, how can I force the CXTPControlEdit to create the internal edit control so that I can call GetEditCtrl()->SetLimitText(3); ?

-------------
Simon HB9DRV


Posted By: Oleg
Date Posted: 13 June 2007 at 12:52am
Right, sorry forgot that Edit control is  actually RichEdit that doesn't support ES_NUMBER flag.
 
For Limit text you can create custom edit:
 
class CMyControlEdit : public CXTPControlEdit
{
 DECLARE_XTP_CONTROL(CMyControlEdit)
 void SetRect(CRect rcControl);
};
IMPLEMENT_XTP_CONTROL(CMyControlEdit, CXTPControlEdit)
void CMyControlEdit::SetRect(CRect rcControl)
{
 CXTPControlEdit::SetRect(rcControl);
 if (m_pEdit->GetSafeHwnd())
 {
  m_pEdit->SetLimitText(3);
 }
}
 
usage:
 CXTPControlEdit* pControlEdit = (CXTPControlEdit*)pToolBarEdit->GetControls()->Add(new CMyControlEdit(), ID_FILE_NEW);


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


Posted By: Simon HB9DRV
Date Posted: 13 June 2007 at 5:42am
Thanks Oleg,
 
Shame that Numeric isn't available - I need to protect my users from themselves  .

Thanks for the hard work...


-------------
Simon HB9DRV



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