<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: NumberField Control</title>
	<atom:link href="http://www.rbdevzone.com/2007/12/numberfield-control/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rbdevzone.com/2007/12/numberfield-control/</link>
	<description>The Real Studio Resource</description>
	<lastBuildDate>Sun, 24 Apr 2011 16:29:07 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
	<item>
		<title>By: Roger Meier</title>
		<link>http://www.rbdevzone.com/2007/12/numberfield-control/#comment-26</link>
		<dc:creator>Roger Meier</dc:creator>
		<pubDate>Mon, 14 Sep 2009 20:17:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.rbdevzone.com/2007/12/numberfield-control/#comment-26</guid>
		<description>I have a slight improvement for the KeyDown event code that may be useful.

The modified version allows the &quot;-&quot; to be typed at any time, not only when the editfield is empty, which is more intuitive. Also, it prevents numbers from being typed in front of the &quot;-&quot; sign, if there is one.

// Allow all numbers, but not in front of a &quot;-&quot;
 If Key &gt;= &quot;0&quot; And Key  0) Then skipKey = False

// Only allow a &quot;-&quot; to be typed in at position 0
 if Key = &quot;-&quot; and me.SelStart = 0 and instr(me.Text, &quot;-&quot;) &lt;= 0 then skipKey = False</description>
		<content:encoded><![CDATA[<p>I have a slight improvement for the KeyDown event code that may be useful.</p>
<p>The modified version allows the &#8220;-&#8221; to be typed at any time, not only when the editfield is empty, which is more intuitive. Also, it prevents numbers from being typed in front of the &#8220;-&#8221; sign, if there is one.</p>
<p>// Allow all numbers, but not in front of a &#8220;-&#8221;<br />
 If Key &gt;= &#8220;0&#8243; And Key  0) Then skipKey = False</p>
<p>// Only allow a &#8220;-&#8221; to be typed in at position 0<br />
 if Key = &#8220;-&#8221; and me.SelStart = 0 and instr(me.Text, &#8220;-&#8221;) &lt;= 0 then skipKey = False</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Hartman</title>
		<link>http://www.rbdevzone.com/2007/12/numberfield-control/#comment-25</link>
		<dc:creator>Mark Hartman</dc:creator>
		<pubDate>Sun, 03 May 2009 13:52:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.rbdevzone.com/2007/12/numberfield-control/#comment-25</guid>
		<description>The added line:

// it’s a number but it could be a leading zero like 05
if me.SelStart = 0 and Key = “0″ then skipKey = True

will not allow any leading zeros. The user should be allow to enter at least one zero but not more than one after that.</description>
		<content:encoded><![CDATA[<p>The added line:</p>
<p>// it’s a number but it could be a leading zero like 05<br />
if me.SelStart = 0 and Key = “0″ then skipKey = True</p>
<p>will not allow any leading zeros. The user should be allow to enter at least one zero but not more than one after that.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: joe</title>
		<link>http://www.rbdevzone.com/2007/12/numberfield-control/#comment-24</link>
		<dc:creator>joe</dc:creator>
		<pubDate>Fri, 13 Mar 2009 19:51:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.rbdevzone.com/2007/12/numberfield-control/#comment-24</guid>
		<description>Thank you very much, Paul!  Odd...when you put the stuff in the right place it works better.

I am trying to understand this OOP stuff: reading all the books I can find about REALbasic, and searching for all the online tutorials that I can find but it is so helpful when others, like yourself, take the time to  answer what must seem so obvious.

Thanks.</description>
		<content:encoded><![CDATA[<p>Thank you very much, Paul!  Odd&#8230;when you put the stuff in the right place it works better.</p>
<p>I am trying to understand this OOP stuff: reading all the books I can find about REALbasic, and searching for all the online tutorials that I can find but it is so helpful when others, like yourself, take the time to  answer what must seem so obvious.</p>
<p>Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul Lefebvre</title>
		<link>http://www.rbdevzone.com/2007/12/numberfield-control/#comment-23</link>
		<dc:creator>Paul Lefebvre</dc:creator>
		<pubDate>Fri, 13 Mar 2009 13:13:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.rbdevzone.com/2007/12/numberfield-control/#comment-23</guid>
		<description>There are two ways to set this property after adding the control to a window:

1. In the property list to the right you will see a value called &quot;Allow Decimals&quot; in the Behavior section.  Simply check it.

2. In the Open event of the control, add the line Me.AllowDecimals = True</description>
		<content:encoded><![CDATA[<p>There are two ways to set this property after adding the control to a window:</p>
<p>1. In the property list to the right you will see a value called &#8220;Allow Decimals&#8221; in the Behavior section.  Simply check it.</p>
<p>2. In the Open event of the control, add the line Me.AllowDecimals = True</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: joe</title>
		<link>http://www.rbdevzone.com/2007/12/numberfield-control/#comment-22</link>
		<dc:creator>joe</dc:creator>
		<pubDate>Fri, 13 Mar 2009 03:54:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.rbdevzone.com/2007/12/numberfield-control/#comment-22</guid>
		<description>Just a quick question...I&#039;m new to REALbasic and really appreciate this NumberField code but I cannot figure out where and how to set AllowDecimals=TRUE.

I tried using it in a button but all I get is &quot;This method or property does not exit&quot; so I guess I don&#039;t understand how/where to set it TRUE.

Any help would be appreciated!

Joe</description>
		<content:encoded><![CDATA[<p>Just a quick question&#8230;I&#8217;m new to REALbasic and really appreciate this NumberField code but I cannot figure out where and how to set AllowDecimals=TRUE.</p>
<p>I tried using it in a button but all I get is &#8220;This method or property does not exit&#8221; so I guess I don&#8217;t understand how/where to set it TRUE.</p>
<p>Any help would be appreciated!</p>
<p>Joe</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Markus Winter</title>
		<link>http://www.rbdevzone.com/2007/12/numberfield-control/#comment-21</link>
		<dc:creator>Markus Winter</dc:creator>
		<pubDate>Wed, 14 Jan 2009 07:42:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.rbdevzone.com/2007/12/numberfield-control/#comment-21</guid>
		<description>Use this improved code in the keydown event - it prevents leading zeros being entered and correctly uses the up and down arrow keys:

Dim skipKey As Boolean = True

  If Key &gt;= &quot;0&quot; And Key &lt;= &quot;9&quot; Then skipKey = False

  If AllowDecimals Then
    If Key = &quot;.&quot; And Not IsDecimalSet Then skipKey = False
  End If

  If Me.Text = &quot;&quot; And Key = &quot;-&quot; Then skipKey = False

  If Key = Chr(8) Then skipKey = False &#039; BackSpace
  If Key = Chr(4) Then skipKey = False &#039; End
  If Key = Chr(1) Then skipKey = False &#039; Home
  If Key = Chr(127) Then skipKey = False &#039; Delete
  If Key = Chr(28) Then skipKey = False &#039; Left arrow
  If Key = Chr(29) Then skipKey = False &#039; Right arrow
  If Key = Chr(30) Then skipKey = False &#039; Up arrow
  If Key = Chr(31) Then skipKey = False &#039; Down arrow
  If Key = Chr(9) Then skipKey = False &#039; Tab

  Dim userKeyDown As Boolean
  userKeyDown = KeyDown(Key)

  If userKeyDown Then
    skipKey = userKeyDown
  End If

   // it&#039;s a number but it could be a leading zero like 05
  if me.SelStart = 0 and Key = &quot;0&quot; then skipKey = True

  Return skipKey</description>
		<content:encoded><![CDATA[<p>Use this improved code in the keydown event &#8211; it prevents leading zeros being entered and correctly uses the up and down arrow keys:</p>
<p>Dim skipKey As Boolean = True</p>
<p>  If Key &gt;= &#8220;0&#8243; And Key &lt;= &#8220;9&#8243; Then skipKey = False</p>
<p>  If AllowDecimals Then<br />
    If Key = &#8220;.&#8221; And Not IsDecimalSet Then skipKey = False<br />
  End If</p>
<p>  If Me.Text = &#8220;&#8221; And Key = &#8220;-&#8221; Then skipKey = False</p>
<p>  If Key = Chr(8) Then skipKey = False &#8216; BackSpace<br />
  If Key = Chr(4) Then skipKey = False &#8216; End<br />
  If Key = Chr(1) Then skipKey = False &#8216; Home<br />
  If Key = Chr(127) Then skipKey = False &#8216; Delete<br />
  If Key = Chr(28) Then skipKey = False &#8216; Left arrow<br />
  If Key = Chr(29) Then skipKey = False &#8216; Right arrow<br />
  If Key = Chr(30) Then skipKey = False &#8216; Up arrow<br />
  If Key = Chr(31) Then skipKey = False &#8216; Down arrow<br />
  If Key = Chr(9) Then skipKey = False &#8216; Tab</p>
<p>  Dim userKeyDown As Boolean<br />
  userKeyDown = KeyDown(Key)</p>
<p>  If userKeyDown Then<br />
    skipKey = userKeyDown<br />
  End If</p>
<p>   // it&#8217;s a number but it could be a leading zero like 05<br />
  if me.SelStart = 0 and Key = &#8220;0&#8243; then skipKey = True</p>
<p>  Return skipKey</p>
]]></content:encoded>
	</item>
</channel>
</rss>

