![]() |
Validation of edit field control |
Post Reply ![]() |
Author | |
mgampi ![]() Senior Member ![]() ![]() Joined: 14 July 2003 Status: Offline Points: 1201 |
![]() ![]() ![]() ![]() ![]() Posted: 11 May 2006 at 11:04am |
Hello; I'm using a CXTPControlEdit derived class with a masked edit control to input timestamps. I tried to resolve this by writing my own CTimeScaleEdit::OnKillFocus() method. void CTimeScaleEdit::OnKillFocus(){ CString strText=GetEditText(); COleDateTime dt; // Try to parse the string if (!dt.ParseDateTime(strText)) { MessageBeep(0xFFFFFFFF); // If this fails GetEditCtrl()->SetFocus(); return; } else { // Reformat the string to be shown as expected CString strBuffer; GetTimestampFormatted(dt, strBuffer.GetBuffer(128), 128); strBuffer.ReleaseBuffer(); SetEditText(strBuffer); } CXTPControlEdit::OnKillFocus(); } When trying this solution the behavior is soewhat undefined because when the vaidation fails once, return keys won't be handled anymore. What am I doing wrong? Whats the best way to handle edit control validation in command bars? Thanx in advance Martin |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |