summaryrefslogtreecommitdiff
path: root/src/gui/gui_listbox.pas
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/gui_listbox.pas')
-rw-r--r--src/gui/gui_listbox.pas14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/gui/gui_listbox.pas b/src/gui/gui_listbox.pas
index 64055937..630390f6 100644
--- a/src/gui/gui_listbox.pas
+++ b/src/gui/gui_listbox.pas
@@ -386,6 +386,10 @@ begin
if ItemCount < 1 then
Exit; //==>
+
+ { User clicked outside listbox bounds. ComboBox requires this check. }
+ if y < 0 then
+ Exit; //==>
FFocusItem := FFirstItem + Trunc((y - FMargin) / RowHeight);
if FFocusItem > ItemCount then
@@ -405,9 +409,13 @@ begin
FMouseDragging := False;
- FFocusItem := FFirstItem + Trunc((y - FMargin) / RowHeight);
- if FFocusItem > ItemCount then
- FFocusItem := ItemCount;
+ { User clicked outside listbox bounds. ComboBox requires this check. }
+ if not (y < 0) then
+ begin
+ FFocusItem := FFirstItem + Trunc((y - FMargin) / RowHeight);
+ if FFocusItem > ItemCount then
+ FFocusItem := ItemCount;
+ end;
FollowFocus;
Repaint;