dialogxml: ensure a container's contents have been resolved before resolving anything else relative to the container

This commit is contained in:
2024-08-31 02:23:22 -04:00
committed by Celtic Minstrel
parent 1db98bc7c0
commit 8a9fb0ed22

View File

@@ -323,6 +323,16 @@ void cDialog::loadFromFile(const DialogDefn& file){
all_resolved = false;
return;
}
if(auto pane = dynamic_cast<cContainer*>(anchor)) {
// If the anchor is a container, make sure to resolve its contents first.
pane->forEach([&all_resolved](const std::string&, cControl& ctrl) {
if(!ctrl.anchor.empty()) {
all_resolved = false;
}
});
if(!all_resolved) return;
pane->recalcRect();
}
ctrl.relocateRelative(ctrl.frame.topLeft(), anchor, ctrl.horz, ctrl.vert);
ctrl.anchor.clear();
ctrl.horz = ctrl.vert = POS_ABS;