Skip to content

Commit

Permalink
Replay scrollbar changes in dialogs' scrollbars
Browse files Browse the repository at this point in the history
  • Loading branch information
NQNStudios committed Feb 27, 2025
1 parent 1c01883 commit dbdde01
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/dialogxml/dialogs/dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,16 @@ void cDialog::handle_events() {
}else if(replaying && has_next_action("field_selection")) {
cTextField& text_field = dynamic_cast<cTextField&>(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<long>(info["newPos"]);

cScrollPane& pane = dynamic_cast<cScrollPane&>(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);
Expand Down

0 comments on commit dbdde01

Please sign in to comment.