diff --git a/src/dialogxml/widgets/control.cpp b/src/dialogxml/widgets/control.cpp index d72e227c..05bf7183 100644 --- a/src/dialogxml/widgets/control.cpp +++ b/src/dialogxml/widgets/control.cpp @@ -39,7 +39,8 @@ std::string cControl::generateRandomString() { void cControl::setText(std::string l){ lbl = l; - recalcRect(); + // TODO: calling recalcRect() here has major unwanted side effects + // recalcRect(); } std::string cControl::getText() const { diff --git a/src/dialogxml/widgets/control.hpp b/src/dialogxml/widgets/control.hpp index e3cb1efe..dc53094d 100644 --- a/src/dialogxml/widgets/control.hpp +++ b/src/dialogxml/widgets/control.hpp @@ -373,15 +373,14 @@ public: if(anchor_id) *anchor_id = anchor; return {horz, vert}; } + /// If the control automatically determines its rect based on certain criteria, override this. + /// It will automatically be called during parsing. + virtual void recalcRect() {} protected: /// Create a new control attached to a dialog. /// @param t The type of the control. /// @param p The parent container. cControl(eControlType t, iComponent* p); - /// If the control automatically determines its rect based on certain criteria, override this. - /// It will automatically be called during parsing. - /// When overridden, it should normally be public. - virtual void recalcRect() {} /// Returns a list of event handlers that this control supports. /// @return The list of handlers as a std::set. /// diff --git a/src/scenedit/scen.keydlgs.cpp b/src/scenedit/scen.keydlgs.cpp index 8df91a2a..532ea40e 100644 --- a/src/scenedit/scen.keydlgs.cpp +++ b/src/scenedit/scen.keydlgs.cpp @@ -248,6 +248,7 @@ short choose_pattern(short cur_choice, cDialog* parent, bool expandRotatable) { std::string id2 = id; id2.replace(0, 3, "name"); pat_dlg[id2].setText(pat.name); + pat_dlg[id2].recalcRect(); if(pat.rotatable) { if(!expandRotatable) { choices.push_back(pat_id);