Infus

Freeze duration on inserting long texts

May 26th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. local backdrop = {
  2. bgFile = [[Interface\Tooltips\UI-Tooltip-Background]],
  3. edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]], edgeSize = 16,
  4. insets = { left = 4, right = 3, top = 4, bottom = 3 }
  5. }
  6.  
  7. local f = CreateFrame("Frame",nil,UIParent)
  8. f:SetFrameStrata("BACKGROUND")
  9. f:SetWidth(200)
  10. f:SetHeight(100)
  11. f:SetBackdrop(backdrop)
  12. f:SetBackdropColor(0, 0, 0)
  13. f:SetBackdropBorderColor(0.4, 0.4, 0.4)
  14.  
  15. local editBox = CreateFrame("EditBox", "testbox", f);
  16. editBox:SetAllPoints();
  17. editBox:SetFontObject(ChatFontNormal)
  18. editBox:SetMultiLine(true)
  19. editBox:EnableMouse(true)
  20. editBox:SetAutoFocus(false)
  21.  
  22. f:SetPoint("CENTER",0,0)
  23. f:Show()
  24.  
  25. local lastFrame;
  26. f:SetScript("OnUpdate", function()
  27. if(not lastFrame) then
  28. lastFrame = GetTime();
  29. else
  30. local timeSinceLastFrame = GetTime() - lastFrame;
  31. if (timeSinceLastFrame > 1) then
  32. print("Took", timeSinceLastFrame);
  33. end
  34. lastFrame = GetTime();
  35. end
  36. end);
Add Comment
Please, Sign In to add comment