mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-23 09:19:17 +02:00
lcl: don't return incorrent ItemIndex (valid values are from -1 to Count - 1)
git-svn-id: trunk@17628 -
This commit is contained in:
parent
1aca8c88b8
commit
7fad68ae28
@ -551,9 +551,12 @@ begin
|
||||
if HandleAllocated then
|
||||
begin
|
||||
Result := TWSCustomListBoxClass(WidgetSetClass).GetItemIndex(Self);
|
||||
FItemIndex:=Result;
|
||||
end else
|
||||
Result:=FItemIndex;
|
||||
if (Result < 0) or (Result >= Count) then
|
||||
Result := -1;
|
||||
FItemIndex := Result;
|
||||
end
|
||||
else
|
||||
Result := FItemIndex;
|
||||
//DebugLn('[TCustomListBox.GetItemIndex] END ');
|
||||
end;
|
||||
|
||||
|
@ -586,11 +586,6 @@ begin
|
||||
else
|
||||
// LB_GETCURSEL is only for single select listbox
|
||||
Result := SendMessage(ACustomListBox.Handle, LB_GETCURSEL, 0, 0);
|
||||
if Result = LB_ERR then
|
||||
begin
|
||||
Assert(false, 'Trace:[TWin32WSCustomListBox.GetItemIndex] could not retrieve itemindex, try selecting an item first');
|
||||
Result := -1;
|
||||
end;
|
||||
end;
|
||||
|
||||
class function TWin32WSCustomListBox.GetItemRect(
|
||||
|
Loading…
Reference in New Issue
Block a user