From 5ff0c24993c52546f1809e87a036d1e8f21d6e17 Mon Sep 17 00:00:00 2001 From: PeterN Date: Sat, 12 Jan 2019 23:23:23 +0000 Subject: Fix #6780: Some windows didn't get updated from OnTick() (#7048) --- src/widgets/dropdown.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/dropdown.cpp b/src/widgets/dropdown.cpp index f8ddf5569..816e981a1 100644 --- a/src/widgets/dropdown.cpp +++ b/src/widgets/dropdown.cpp @@ -14,6 +14,7 @@ #include "../string_func.h" #include "../strings_func.h" #include "../window_func.h" +#include "../guitimer_func.h" #include "dropdown_type.h" #include "dropdown_widget.h" @@ -97,6 +98,7 @@ struct DropdownWindow : Window { bool drag_mode; bool instant_close; ///< Close the window when the mouse button is raised. int scrolling; ///< If non-zero, auto-scroll the item list (one time). + GUITimer scrolling_timer; ///< Timer for auto-scroll of the item list. Point position; ///< Position of the topleft corner of the window. Scrollbar *vscroll; @@ -155,6 +157,7 @@ struct DropdownWindow : Window { this->click_delay = 0; this->drag_mode = true; this->instant_close = instant_close; + this->scrolling_timer = GUITimer(MILLISECONDS_PER_TICK); } ~DropdownWindow() @@ -254,8 +257,11 @@ struct DropdownWindow : Window { } } - virtual void OnTick() + virtual void OnRealtimeTick(uint delta_ms) { + if (!this->scrolling_timer.Elapsed(delta_ms)) return; + this->scrolling_timer.SetInterval(MILLISECONDS_PER_TICK); + if (this->scrolling != 0) { int pos = this->vscroll->GetPosition(); -- cgit v1.2.3-70-g09d2