CompuServe Messages

#CEdit

    10-Jul-94 13:27:41
Sb: #30411-#CEdit
Fm: Charles Steinhardt 70353,2604
To: Jay Perkins 74664,3046
Jay, I read ur message and I have a few comments. These comments will have "///////////////////////**CSS ….." prefacing them Here is the Header and CPP file of "MYEdit". //***************************************************************************** ************************* //***************************************************************************** ************************* //***************************************************************************** ************************* class CFEdit : public CEdit { // Construction public: CFEdit(); CString Mask; //This is the Picture used to format the text CString Incoming; //This is the Typed (NUMBERS ONLY) characters ///////////////////////**CSS Why do you have a class scope resolution here? CString CFEdit::Merge_Mask(CString raw,CString Picture); void Init(CString ivalue,CString mask); public: virtual ~CFEdit(); protected: //{{AFX_MSG(CFEdit) afx_msg UINT OnGetDlgCode(); afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; This is the CPP File; #include "stdafx.h" #include "halstr.h" #include "fedit.h" //***************************************************************************** ************************* //***************************************************************************** ************************* //***************************************************************************** ************************* CFEdit::CFEdit() { } //***************************************************************************** ************************* //***************************************************************************** ************************* //****************************************************************************** ************************ CFEdit::~CFEdit() { } //***************************************************************************** ************************* //***************************************************************************** ************************* //***************************************************************************** ************************* BEGIN_MESSAGE_MAP(CFEdit, CEdit) //{{AFX_MSG_MAP(CFEdit) ON_WM_GETDLGCODE() ON_WM_KEYDOWN() ON_WM_CHAR() //}}AFX_MSG_MAP END_MESSAGE_MAP() //***************************************************************************** ************************* //***************************************************************************** ************************* //***************************************************************************** ************************* void CFEdit::Init(CString ivalue,CString mask) { ///////////////////////**CSS When does this ini function ever get called??? Did you mean to call this in the construtor? this->SetWindowText(ivalue); Mask = mask; ///////////////////////**CSS It doesn't die here, right? Incoming = ""; }; //***************************************************************************** ************************* //***************************************************************************** ************************* //***************************************************************************** ************************* UINT CFEdit::OnGetDlgCode() { return DLGC_WANTARROWS|DLGC_WANTALLKEYS|DLGC_WANTCHARS; }; //***************************************************************************** ************************* //***************************************************************************** ************************* //****************************************************************************** ************************ CString CFEdit::Merge_Mask(CString raw,CString Picture) { }; //***************************************************************************** ************************* //***************************************************************************** ************************* //***************************************************************************** ************************* ///////////////////////**CSS Get rid of "afx_msg" here afx_msg void CFEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) { if ((nChar >= '0') && (nChar <= '9')) { //****** "Incoming" is the CString that appears not Initialized!*************** ///////////////////////**CSS If you set a break point, what does "watch" (shift+F9) show regarding this "Incoming" CString? Incoming += nChar; // <<===This is where It Dies!!!!! CString Temp = Merge_Mask(Incoming,Mask); this->SetWindowText(Temp); } else MessageBeep(0); } //***************************************************************************** ************************* //***************************************************************************** ************************* //***************************************************************************** ************************* void CFEdit::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) { CEdit::OnKeyDown(nChar, nRepCnt, nFlags); }; //***************************************************************************** ************************* //***************************************************************************** ************************* //***************************************************************************** ************************* ///////////////////////**CSS My last question is, how and when do you define the CFEdit in your CDialog object? Speak with you soon, Charles Steinhardt OMG Inc.