WoWInterface - View Single Post - insertedFrame for StaticPopup_Show() not working
View Single Post
04-06-21, 04:47 PM   #1
A Frostmaul Preserver
LudiusMaximus's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 283
insertedFrame for StaticPopup_Show() not working

I want to display some easy-to-copy text in a popup dialog.

So I thought StaticPopup_Show() with an edit box as the 'insertedFrame' argument would be the straight forward way to achieve this.

But for some reason, passing the frame to StaticPopup_Show() like this does not do anything at all:

Lua Code:
  1. local scrollFrame = CreateFrame("ScrollFrame", nil, nil, "UIPanelScrollFrameTemplate")
  2. scrollFrame:SetSize(300, 80)
  3. scrollFrame:SetPoint("CENTER")
  5. local editbox = CreateFrame("EditBox", nil, scrollFrame, "InputBoxScriptTemplate")
  6. editbox:SetMultiLine(true)
  7. editbox:SetAutoFocus(false)
  8. editbox:SetFontObject(ChatFontNormal)
  9. editbox:SetWidth(300)
  10. editbox:SetText("test\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\n")
  11. editbox:SetCursorPosition(0)
  12. scrollFrame:SetScrollChild(editbox)
  14. StaticPopupDialogs["MY_TEST"] = {
  15.     text = "Test",
  16.     button1 = "OK",
  17. }
  19. StaticPopup_Show("MY_TEST", scrollFrame)

When I look at the code of StaticPopup_Show(), I cannot see why it should not work:

Can anybody explain this to me? Thanks!
~ Be the change you want to see in the world... of warcraft interface! ~
  Reply With Quote