First Patch (setfocus in IP Address control, dlls/comctl32/ipaddress.c)--Please correct me on procedure/etiquette

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

First Patch (setfocus in IP Address control, dlls/comctl32/ipaddress.c)--Please correct me on procedure/etiquette

Alex Zorach / Sustainable Computing
Hello!

This patch corrects the behaviour of the IP Address control to conform
to Windows behaviour--as tested with Microsoft's ControlSpy on Windows
2000, and also reduces the code size.

Previously, the SetFocus method would reset the index to 0 due to a bug
in the conditional statement causing it to always be true.  The first
for loop was also unnecessary--windows does not check to see if there is
any text in the fields.  As far as I have tested, this now behaves the
way it should.

--Alex Zorach
[hidden email]

diff -u -r1.41 ipaddress.c
--- dlls/comctl32/ipaddress.c   9 May 2005 09:24:05 -0000       1.41
+++ dlls/comctl32/ipaddress.c   8 Jun 2005 16:50:22 -0000
@@ -346,11 +346,7 @@
 {
     TRACE("(index=%d)\n", index);

-    if (index > 3) {
-       for (index = 0; index < 4; index++)
-           if (!GetWindowTextLengthW(infoPtr->Part[index].EditHwnd)) break;
-    }
-    if (index < 9 || index > 3) index = 0;
+    if (index > 3 || index < 0) index=0;

     SetFocus (infoPtr->Part[index].EditHwnd);
 }