Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - [Closed] CXTPControlEdit - Numeric
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

[Closed] CXTPControlEdit - Numeric

 Post Reply Post Reply
Author
Message
Simon HB9DRV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 July 2005
Location: Switzerland
Status: Offline
Points: 458
Post Options Post Options   Thanks (0) Thanks(0)   Quote Simon HB9DRV Quote  Post ReplyReply Direct Link To This Post Topic: [Closed] CXTPControlEdit - Numeric
    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
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 12 June 2007 at 2:35am
Hi,
Call pControl->SetEditStyle(ES_NUMBER);
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Simon HB9DRV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 July 2005
Location: Switzerland
Status: Offline
Points: 458
Post Options Post Options   Thanks (0) Thanks(0)   Quote Simon HB9DRV Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Simon HB9DRV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 July 2005
Location: Switzerland
Status: Offline
Points: 458
Post Options Post Options   Thanks (0) Thanks(0)   Quote Simon HB9DRV Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Simon HB9DRV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 July 2005
Location: Switzerland
Status: Offline
Points: 458
Post Options Post Options   Thanks (0) Thanks(0)   Quote Simon HB9DRV Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.140 seconds.