View Single Post
06-19-17, 04:39 PM   #2
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,026
You can find references by looking in some of these notepad addons
http://www.wowinterface.com/forums/s...ad.php?t=53494

I personally use the below example in my own addons


Lua Code:
  1. function KethoEditBox_Show(text)
  2.     if not KethoEditBox then
  3.         local f = CreateFrame("Frame", "KethoEditBox", UIParent, "DialogBoxFrame")
  4.         f:SetPoint("CENTER")
  5.         f:SetSize(600, 500)
  6.        
  7.         f:SetBackdrop({
  8.             bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
  9.             edgeFile = "Interface\\PVPFrame\\UI-Character-PVP-Highlight", -- this one is neat
  10.             edgeSize = 16,
  11.             insets = { left = 8, right = 6, top = 8, bottom = 8 },
  12.         })
  13.         f:SetBackdropBorderColor(0, .44, .87, 0.5) -- darkblue
  14.        
  15.         -- Movable
  16.         f:SetMovable(true)
  17.         f:SetClampedToScreen(true)
  18.         f:SetScript("OnMouseDown", function(self, button)
  19.             if button == "LeftButton" then
  20.                 self:StartMoving()
  21.             end
  22.         end)
  23.         f:SetScript("OnMouseUp", f.StopMovingOrSizing)
  24.        
  25.         -- ScrollFrame
  26.         local sf = CreateFrame("ScrollFrame", "KethoEditBoxScrollFrame", KethoEditBox, "UIPanelScrollFrameTemplate")
  27.         sf:SetPoint("LEFT", 16, 0)
  28.         sf:SetPoint("RIGHT", -32, 0)
  29.         sf:SetPoint("TOP", 0, -16)
  30.         sf:SetPoint("BOTTOM", KethoEditBoxButton, "TOP", 0, 0)
  31.        
  32.         -- EditBox
  33.         local eb = CreateFrame("EditBox", "KethoEditBoxEditBox", KethoEditBoxScrollFrame)
  34.         eb:SetSize(sf:GetSize())
  35.         eb:SetMultiLine(true)
  36.         eb:SetAutoFocus(false) -- dont automatically focus
  37.         eb:SetFontObject("ChatFontNormal")
  38.         eb:SetScript("OnEscapePressed", function() f:Hide() end)
  39.         sf:SetScrollChild(eb)
  40.        
  41.         -- Resizable
  42.         f:SetResizable(true)
  43.         f:SetMinResize(150, 100)
  44.        
  45.         local rb = CreateFrame("Button", "KethoEditBoxResizeButton", KethoEditBox)
  46.         rb:SetPoint("BOTTOMRIGHT", -6, 7)
  47.         rb:SetSize(16, 16)
  48.        
  49.         rb:SetNormalTexture("Interface\\ChatFrame\\UI-ChatIM-SizeGrabber-Up")
  50.         rb:SetHighlightTexture("Interface\\ChatFrame\\UI-ChatIM-SizeGrabber-Highlight")
  51.         rb:SetPushedTexture("Interface\\ChatFrame\\UI-ChatIM-SizeGrabber-Down")
  52.        
  53.         rb:SetScript("OnMouseDown", function(self, button)
  54.             if button == "LeftButton" then
  55.                 f:StartSizing("BOTTOMRIGHT")
  56.                 self:GetHighlightTexture():Hide() -- more noticeable
  57.             end
  58.         end)
  59.         rb:SetScript("OnMouseUp", function(self, button)
  60.             f:StopMovingOrSizing()
  61.             self:GetHighlightTexture():Show()
  62.             eb:SetWidth(sf:GetWidth())
  63.         end)
  64.         f:Show()
  65.     end
  66.    
  67.     if text then
  68.         KethoEditBoxEditBox:SetText(text)
  69.     end
  70.     KethoEditBox:Show()
  71. end

Last edited by Ketho : 06-19-17 at 05:18 PM.
  Reply With Quote