< prev index next >

src/java.desktop/windows/native/libawt/windows/awt_List.cpp

Print this page

        

*** 476,497 **** } MsgRouting AwtList::HandleEvent(MSG *msg, BOOL synthetic) { if (IsFocusingMouseMessage(msg)) { LONG item = static_cast<LONG>(SendListMessage(LB_ITEMFROMPOINT, 0, msg->lParam)); ! if (item != LB_ERR) { if (isMultiSelect) { if (IsItemSelected(item)) { Deselect(item); } else { Select(item); } } else { Select(item); } } delete msg; return mrConsume; } if (msg->message == WM_KEYDOWN && msg->wParam == VK_RETURN) { WmNotify(LBN_DBLCLK); --- 476,502 ---- } MsgRouting AwtList::HandleEvent(MSG *msg, BOOL synthetic) { if (IsFocusingMouseMessage(msg)) { + LONG count = GetCount(); + if (count > 0) { LONG item = static_cast<LONG>(SendListMessage(LB_ITEMFROMPOINT, 0, msg->lParam)); ! if (HIWORD(item) == 0) { ! if (item >= 0 && item < count) { if (isMultiSelect) { if (IsItemSelected(item)) { Deselect(item); } else { Select(item); } } else { Select(item); } } + } + } delete msg; return mrConsume; } if (msg->message == WM_KEYDOWN && msg->wParam == VK_RETURN) { WmNotify(LBN_DBLCLK);
< prev index next >