ui-widgets: delay question dialog autosizing

This commit is contained in:
shagu
2019-06-11 19:41:33 +02:00
parent fe479d1f77
commit d44188d166
+7 -2
View File
@@ -762,8 +762,13 @@ function pfUI.api.CreateQuestionDialog(text, yes, no, editbox, onclose)
question:SetHeight(textspace + inputspace + buttonspace + padding)
local width = 200
if question.text:GetStringWidth() > 200 then width = question.text:GetStringWidth() end
question:SetWidth( width + 2*padding)
-- delay the auto sizing, to make sure the font rendering happened
question:SetScript("OnUpdate", function()
if question.text:GetStringWidth() > width then width = question.text:GetStringWidth() end
question:SetWidth( width + 2*padding)
this:SetScript("OnUpdate", nil)
end)
end