<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to 175: wxNumberValidator - 0 greater than 0.001 error</title><link>https://sourceforge.net/p/wxcode/bugs/175/</link><description>Recent changes to 175: wxNumberValidator - 0 greater than 0.001 error</description><atom:link href="https://sourceforge.net/p/wxcode/bugs/175/feed.rss" rel="self"/><language>en</language><lastBuildDate>Wed, 10 May 2017 17:39:24 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/wxcode/bugs/175/feed.rss" rel="self" type="application/rss+xml"/><item><title>#175 wxNumberValidator - 0 greater than 0.001 error</title><link>https://sourceforge.net/p/wxcode/bugs/175/?limit=25#9e44/b1ec/2c7e</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;It is ok now. Good work Manuel !&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Gilbert Pelletier</dc:creator><pubDate>Wed, 10 May 2017 17:39:24 -0000</pubDate><guid>https://sourceforge.net3683eda9a910bd72ce7dd924bd133fb55bbaf633</guid></item><item><title>#175 wxNumberValidator - 0 greater than 0.001 error</title><link>https://sourceforge.net/p/wxcode/bugs/175/?limit=25#9e44/b1ec</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;Now fixed and updated (FormatValidator_22).&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Manuel Martin</dc:creator><pubDate>Wed, 10 May 2017 17:28:29 -0000</pubDate><guid>https://sourceforge.net40455808fa70f19e63c589746b0ed52bcc2a14ef</guid></item><item><title>#175 wxNumberValidator - 0 greater than 0.001 error</title><link>https://sourceforge.net/p/wxcode/bugs/175/?limit=25#9e44</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;Yes, those lines in fvalgred need changes for wx3.1. And also some sizers flags in the example.&lt;br/&gt;
I'll fix them soon.&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Manuel Martin</dc:creator><pubDate>Wed, 10 May 2017 14:46:04 -0000</pubDate><guid>https://sourceforge.netd9e3c158d5e3230a035e900757b95bcb558e5734</guid></item><item><title>#175 wxNumberValidator - 0 greater than 0.001 error</title><link>https://sourceforge.net/p/wxcode/bugs/175/?limit=25#d4a9/451c</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;That works well. Thank-you!&lt;/p&gt;
&lt;p&gt;But now (with version 2.1) I have errors in fvalgred.cpp, lines 89, 91, 95 and 97. The arguments of wxGrid::SetCellTextColour() and wxGrid::SetCellBackgroundColour() are respectively: color, row and column. This is deprecated. The new version needs: row, column and color.&lt;/p&gt;
&lt;p&gt;I have wxWidgets 3.1 compiled with WXWIN_COMPATIBILITY_2_8 and WXWIN_COMPATIBILITY_3_0 defined to 0.&lt;/p&gt;
&lt;p&gt;The version 2.0 of fvalgred.cpp used the new way (row, column, color) and compiled correctly. So maybe you did the change to be compatible with older versions of wxWidgets? If this is the case it would be better to use conditional compilation I guess (depending on wxWidget's version).&lt;/p&gt;
&lt;p&gt;Have a good day !&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Gilbert Pelletier</dc:creator><pubDate>Wed, 10 May 2017 14:39:09 -0000</pubDate><guid>https://sourceforge.netdb8554a0e83321e963dd187a102de8f5bb68ad31</guid></item><item><title>#175 wxNumberValidator - 0 greater than 0.001 error</title><link>https://sourceforge.net/p/wxcode/bugs/175/?limit=25#d4a9</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;Thank you very much for finding this bug.&lt;br/&gt;
I prefer not to add another function. In this case this is easy as wxFormatStringAsNumber::StringToParts() sets a '0' for sP.sDigits when it's really zero.&lt;/p&gt;
&lt;p&gt;I've fixed the bug. Please download FormatValidator_21.zip from wxCode&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Manuel Martin</dc:creator><pubDate>Tue, 09 May 2017 23:05:34 -0000</pubDate><guid>https://sourceforge.netf0410e469b822b20e2abcb40c4eff22a684b7c5d</guid></item><item><title>wxNumberValidator - 0 greater than 0.001 error</title><link>https://sourceforge.net/p/wxcode/bugs/175/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;In fvalnum.cpp, function CompParts(), line 1215, for two numbers having the same sign, the one having the smaller exponent is considered the smaller. This is not true if one of them is 0. Example:&lt;/p&gt;
&lt;p&gt;0 = +0e0&lt;br/&gt;
0.001 = +1e-3&lt;/p&gt;
&lt;p&gt;Exponent -3 is smaller than exponent 0, but 0.001 is greater than 0.&lt;/p&gt;
&lt;p&gt;I inserted the following code at line 1215 (before comparing exponents):&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;bool left = IsZero(sP1);
bool right = IsZero(sP2);

if (left &amp;amp;&amp;amp; right)  return (0);         // Both 0
if (left)  return(sP2.sSign ? -1 : 1);  // One is 0, the other not. The other is...
if (right) return(sP1.sSign ? 1 : -1);  // ...smaller/bigger depending in it's sign.
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;And I added a new function IsZero() as this:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;bool wxNumberValidator::IsZero(const stringParts&amp;amp; sP)
{

if (sP.sExp != 0)  return (false);

int     len = sP.sDigits.Len();

for (int i = 0; i &amp;lt; len; i++)  {
    if (sP.sDigits.at(i) != L'0')  return (false);
}

return (true);

}
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;This way, if both numbers are 0, CompParts() returns 0. And if only one number is 0, the other is smaller or greater depending on it's sign. Negative is smaller than 0, and positive is greater.&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Gilbert Pelletier</dc:creator><pubDate>Tue, 09 May 2017 16:18:50 -0000</pubDate><guid>https://sourceforge.net78a8c24f2cd8c323876b94bbcfc0ecdd447983ff</guid></item></channel></rss>