View Single Post
04-07-21, 12:58 AM   #7
LudiusMaximus
A Rage Talon Dragon Guard
 
LudiusMaximus's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 320
Originally Posted by Fizzlemizz View Post
If it's just for Copy/Paste the scrollbar will be pretty useless when they can just CTRL-A/CTRL-C. You can probably hide the bar.

StaticPopup is using the size of the frame you passed it and the scrollbar is another frame attached to the right hand side of it in the creation of the UIPanelScrollFrameTemplate.

Right, I ended up doing it like this:

Lua Code:
  1. local scrollBoxWidth = 400
  2. local scrollBoxHeight = 120
  3.  
  4. local outerFrame = CreateFrame("Frame")
  5. outerFrame:SetSize(scrollBoxWidth + 80, scrollBoxHeight + 20)
  6.  
  7. local borderFrame = CreateFrame("Frame", nil, outerFrame, "TooltipBackdropTemplate")
  8. borderFrame:SetSize(scrollBoxWidth + 34, scrollBoxHeight + 10)
  9. borderFrame:SetPoint("CENTER")
  10.  
  11. local scrollFrame = CreateFrame("ScrollFrame", nil, outerFrame, "UIPanelScrollFrameTemplate")
  12. scrollFrame:SetPoint("CENTER", -10, 0)
  13. scrollFrame:SetSize(scrollBoxWidth, scrollBoxHeight)
  14.  
  15.  
  16. local editbox = CreateFrame("EditBox", nil, scrollFrame, "InputBoxScriptTemplate")
  17. editbox:SetMultiLine(true)
  18. editbox:SetAutoFocus(false)
  19. editbox:SetFontObject(ChatFontNormal)
  20. editbox:SetWidth(scrollBoxWidth)
  21. editbox:SetText("test\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\n")
  22. editbox:SetCursorPosition(0)
  23. scrollFrame:SetScrollChild(editbox)
  24.  
  25. StaticPopupDialogs["MY_TEST"] = {
  26.     text = "Test",
  27.     button1 = "OK",
  28. }
  29.  
  30. local dialog = StaticPopup_Show("MY_TEST", nil, nil, nil, outerFrame)



Thanks again!
__________________
~ Be the change you want to see in the world... of warcraft interface! ~
  Reply With Quote