From f8f9e30f801e2c4bd764321f6c9ca6108080ca88 Mon Sep 17 00:00:00 2001 From: zuu Date: Sat, 14 Sep 2013 12:18:36 +0000 Subject: (svn r25771) -Fix (r25344): If story book content changed height due a string parameter changing length, the scrollbar was not updated --- src/story_gui.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/story_gui.cpp') diff --git a/src/story_gui.cpp b/src/story_gui.cpp index 49913bbbf..defbb6449 100644 --- a/src/story_gui.cpp +++ b/src/story_gui.cpp @@ -479,6 +479,21 @@ public: } } + virtual void OnPaint() + { + /* Detect if content has changed height. This can happen if a + * multi-line text contains eg. {COMPANY} and that company is + * renamed. + */ + if (this->vscroll->GetCount() != this->GetContentHeight()) { + this->vscroll->SetCount(this->GetContentHeight()); + this->SetWidgetDirty(WID_SB_SCROLLBAR); + this->SetWidgetDirty(WID_SB_PAGE_PANEL); + } + + this->DrawWidgets(); + } + virtual void DrawWidget(const Rect &r, int widget) const { if (widget != WID_SB_PAGE_PANEL) return; -- cgit v1.2.3-54-g00ecf