Quantcast [Q] HOWTO: Scroll frame with EditBox - WoWInterface
Thread Tools Display Modes
01-10-19, 07:11 PM   #1
mtp1032
A Deviate Faerie Dragon
Join Date: Jan 2006
Posts: 12
[Q] HOWTO: Scroll frame with EditBox

Greetings,

What approach should I use to develop an EditBox frame with a scroll bar - like a Chat frame but with the ability to copy the text (in whole or in part) to the player's clipboard?

I've done a standard message frame with a scroll bar using the "FauxScrollFrameTemplate". But given my experience trying to adapt my code to use an EditBox with the Faux scroll frame have met with little success. Any advice?

Thanks

Last edited by mtp1032 : 01-10-19 at 07:48 PM. Reason: Way too much information. Cut the original post by 90%
  Reply With Quote
01-10-19, 10:37 PM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 982
You can Highlight selected text but you can't programmatically access the clipboard only CTRL-C/CTRL-V etc.

Lua Code:
  1. local backdrop = {
  2.     bgFile = "Interface/BUTTONS/WHITE8X8",
  3.     edgeFile = "Interface/GLUES/Common/Glue-Tooltip-Border",
  4.     tile = true,
  5.     edgeSize = 8,
  6.     tileSize = 8,
  7.     insets = {
  8.         left = 5,
  9.         right = 5,
  10.         top = 5,
  11.         bottom = 5,
  12.     },
  13. }
  14.  
  15.  
  16. local f = CreateFrame("Frame", "MyScrollMessageTextFrame", UIParent)
  17. f:SetSize(150, 150)
  18. f:SetPoint("CENTER")
  19. f:SetFrameStrata("BACKGROUND")
  20. f:SetBackdrop(backdrop)
  21. f:SetBackdropColor(0, 0, 0)
  22. f.Close = CreateFrame("Button", "$parentClose", f)
  23. f.Close:SetSize(24, 24)
  24. f.Close:SetPoint("TOPRIGHT")
  25. f.Close:SetNormalTexture("Interface/Buttons/UI-Panel-MinimizeButton-Up")
  26. f.Close:SetPushedTexture("Interface/Buttons/UI-Panel-MinimizeButton-Down")
  27. f.Close:SetHighlightTexture("Interface/Buttons/UI-Panel-MinimizeButton-Highlight", "ADD")
  28. f.Close:SetScript("OnClick", function(self)
  29.     self:GetParent():Hide()
  30. end)
  31. f.Select = CreateFrame("Button", "$parentSelect", f, "UIPanelButtonTemplate")
  32. f.Select:SetSize(14, 14)
  33. f.Select:SetPoint("RIGHT", f.Close, "LEFT")
  34. f.Select:SetText("S")
  35. f.Select:SetScript("OnClick", function(self)
  36.     self:GetParent().Text:HighlightText() -- parameters (start, end) or default all
  37.     self:GetParent().Text:SetFocus()
  38. end)
  39.  
  40. f.SF = CreateFrame("ScrollFrame", "$parent_DF", f, "UIPanelScrollFrameTemplate")
  41. f.SF:SetPoint("TOPLEFT", f, 12, -30)
  42. f.SF:SetPoint("BOTTOMRIGHT", f, -30, 10)
  43. f.Text = CreateFrame("EditBox", nil, f)
  44. f.Text:SetMultiLine(true)
  45. f.Text:SetSize(180, 170)
  46. f.Text:SetPoint("TOPLEFT", f.SF)
  47. f.Text:SetPoint("BOTTOMRIGHT", f.SF)
  48. f.Text:SetMaxLetters(99999)
  49. f.Text:SetFontObject(GameFontNormal)
  50. f.Text:SetAutoFocus(false)
  51. f.Text:SetScript("OnEscapePressed", function(self) self:ClearFocus() end)
  52. f.SF:SetScrollChild(f.Text)
  53.  
  54. f.Text:SetText("bfs fasjdf dsaf adsj fasjkf bsafjsaf bjs fasjkf bjsf basf badsjkf dsakfbhaskf asjkf asjkf skaf sak fsk fdsaf kkl l fjds rewpwfrjpo foewf jjfwe fpwfevzv mcvn  qo fnaw[ffgngnerf we foiweffgorenfg[f fewfn sdskfn asdf sp ffq[ofkgbhp    i regp nIF N 'OFGRE  NG;G KG IGN ;EFPIREG REG  ZG;  ergregp esg gg-ero  rdf45540 4y   q8wffn ")
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
01-11-19, 07:00 PM   #3
mtp1032
A Deviate Faerie Dragon
Join Date: Jan 2006
Posts: 12
Thanks. I was never expecting to copy/paste programmatically. But, that's a nano-nit. Thanks for the direction. It helped a lot.

Cheers
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » [Q] HOWTO: Scroll frame with EditBox

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off