don't look up list items with negative index Modified: trunk/reactos/lib/aclui/checklist.c _____
Modified: trunk/reactos/lib/aclui/checklist.c --- trunk/reactos/lib/aclui/checklist.c 2005-07-03 01:44:25 UTC (rev 16384) +++ trunk/reactos/lib/aclui/checklist.c 2005-07-03 02:02:47 UTC (rev 16385) @@ -63,17 +63,20 @@
{ PCHECKITEM Item, Found = NULL;
- for (Item = infoPtr->CheckItemListHead; - Item != NULL; - Item = Item->Next) + if (Index >= 0) { - if (Index == 0) + for (Item = infoPtr->CheckItemListHead; + Item != NULL; + Item = Item->Next) { - Found = Item; - break; + if (Index == 0) + { + Found = Item; + break; + } + + Index--; } - - Index--; }
return Found; @@ -1281,11 +1284,6 @@ pt.x = (LONG)LOWORD(lParam); pt.y = (LONG)HIWORD(lParam);
- if (!infoPtr->HasFocus) - { - SetFocus(hwnd); - } - NewFocus = PtToCheckItemBox(infoPtr, &pt, &NewFocusBox, @@ -1321,6 +1319,11 @@ NewFocus, NewFocusBox); } + + if (!infoPtr->HasFocus) + { + SetFocus(hwnd); + } } break; }