From 51e10671c0604faea9fa44512c848f3f5b36abb7 Mon Sep 17 00:00:00 2001 From: Thomas Bluemel Date: Sun, 3 Jul 2005 02:02:47 +0000 Subject: [PATCH] don't look up list items with negative index svn path=/trunk/; revision=16385 --- reactos/lib/aclui/checklist.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/reactos/lib/aclui/checklist.c b/reactos/lib/aclui/checklist.c index 7649475a122..cb798b960b4 100644 --- a/reactos/lib/aclui/checklist.c +++ b/reactos/lib/aclui/checklist.c @@ -63,17 +63,20 @@ FindCheckItemByIndex(IN PCHECKLISTWND infoPtr, { 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 @@ CheckListWndProc(IN HWND hwnd, pt.x = (LONG)LOWORD(lParam); pt.y = (LONG)HIWORD(lParam); - if (!infoPtr->HasFocus) - { - SetFocus(hwnd); - } - NewFocus = PtToCheckItemBox(infoPtr, &pt, &NewFocusBox, @@ -1321,6 +1319,11 @@ CheckListWndProc(IN HWND hwnd, NewFocus, NewFocusBox); } + + if (!infoPtr->HasFocus) + { + SetFocus(hwnd); + } } break; }