<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="https://syndication.webwiz.net/rss_namespace/">
 <channel>
  <title>Codejock Developer Community : Validati&#111;n of edit field c&#111;ntrol</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Command Bars : Validati&#111;n of edit field c&#111;ntrol]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Wed, 10 Jun 2026 02:40:36 +0000</pubDate>
  <lastBuildDate>Thu, 11 May 2006 11:04:48 +0000</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 12.04</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>forum.codejock.com/RSS_post_feed.asp?TID=4196</WebWizForums:feedURL>
  <image>
   <title><![CDATA[Codejock Developer Community]]></title>
   <url>http://forum.codejock.com/forum_images/codejock-logo.gif</url>
   <link>http://forum.codejock.com/</link>
  </image>
  <item>
   <title><![CDATA[Validati&#111;n of edit field c&#111;ntrol : Hello; I&amp;#039;m using a CXTPControlEdit...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=4196&amp;PID=12881&amp;title=validation-of-edit-field-control#12881</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=109">mgampi</a><br /><strong>Subject:</strong> 4196<br /><strong>Posted:</strong> 11 May 2006 at 11:04am<br /><br /><P>Hello;</P><P>I'm using a CXTPControlEdit derived class with a masked edit control to input timestamps.<BR>The user should be able to insert the timestamp and before loosing focus (tabbing to next field) the input should be validated and when validation fails not loose the focus.</P><P>I tried to resolve this by writing my own CTimeScaleEdit::OnKillFocus() method.<BR>This methode looks like </P><FONT color=#0000ff size=2><P><FONT face="Courier New, Courier, mono">void</FONT></FONT><FONT face="Courier New, Courier, mono" size=2> CTimeScaleEdit::OnKillFocus()<BR>{<BR>&nbsp;&nbsp; CString strText=GetEditText();<BR>&nbsp;&nbsp; COleDateTime dt;<BR>&nbsp;&nbsp; // Try to parse the string</FONT><FONT size=2><BR></FONT><FONT face="Courier New, Courier, mono" color=#0000ff size=2>&nbsp;&nbsp; if</FONT><FONT face="Courier New, Courier, mono"><FONT size=2> (!dt.ParseDateTime(strText))<BR>&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MessageBeep(0xFFFFFFFF);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // If this fails&nbsp;<BR></FONT><FONT color=#008000 size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></FONT><FONT face="Courier New, Courier, mono"><FONT size=2>GetEditCtrl()-&gt;SetFocus();<BR></FONT><FONT color=#0000ff size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return</FONT></FONT><FONT face="Courier New, Courier, mono" size=2>;<BR>&nbsp;&nbsp; }<BR></FONT><FONT face="Courier New, Courier, mono" color=#0000ff size=2>&nbsp;&nbsp; else<BR></FONT><FONT face="Courier New, Courier, mono" size=2>&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Reformat the string to be shown as expected<BR></FONT><FONT face="Courier New, Courier, mono" size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CString strBuffer;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GetTimestampFormatted(dt, strBuffer.GetBuffer(128), 128);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strBuffer.ReleaseBuffer();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SetEditText(strBuffer);<BR>&nbsp;&nbsp; }<BR>&nbsp;&nbsp; CXTPControlEdit::OnKillFocus();<BR>}</FONT></P><P><FONT size=2>When trying this solution the behavior is soewhat undefined because when the vaidation fails once, return keys won't be handled anymore.</FONT></P><P><FONT size=2>What am I doing wrong? Whats the best way to handle edit control validation in command bars?</FONT></P><P><FONT size=2>Thanx in advance</FONT></P><P><FONT size=2>Martin</FONT></P>]]>
   </description>
   <pubDate>Thu, 11 May 2006 11:04:48 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=4196&amp;PID=12881&amp;title=validation-of-edit-field-control#12881</guid>
  </item> 
 </channel>
</rss>