From 126245180a8972e01593c054d7909e0416a8be26 Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Sun, 23 Feb 2025 09:47:16 -0600 Subject: [PATCH] Replay scrollbar changes in dialogs' scrollbars --- src/dialogxml/dialogs/dialog.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/dialogxml/dialogs/dialog.cpp b/src/dialogxml/dialogs/dialog.cpp index 792de258..b77a43f8 100644 --- a/src/dialogxml/dialogs/dialog.cpp +++ b/src/dialogxml/dialogs/dialog.cpp @@ -569,6 +569,16 @@ void cDialog::handle_events() { }else if(replaying && has_next_action("field_selection")) { cTextField& text_field = dynamic_cast(getControl(currentFocus)); text_field.replay_selection(pop_next_action()); + }else if(replaying && has_next_action("scrollbar_setPosition")){ + Element& next_action = pop_next_action(); + auto info = info_from_action(next_action); + std::string name = info["name"]; + long newPos = boost::lexical_cast(info["newPos"]); + + cScrollPane& pane = dynamic_cast(getControl(name)); + pane.getScroll().setPosition(newPos); + }else if(replaying && has_next_action()){ + throw std::string { "Replaying a dialog, have the wrong replay action: " + next_action_type() }; }else{ while(pollEvent(win, currentEvent)){ handle_one_event(currentEvent, fps_limiter);