Advertisement
Dramiel

ResizeToText error

Jul 10th, 2011
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.82 KB | None | 0 0
  1. local context = UI.CreateContext("Frame test");
  2.  
  3. local parentFrame = UI.CreateFrame("Frame", "Parent frame", context);
  4. parentFrame:SetPoint("CENTER", UIParent, "CENTER", 0, 0);
  5. parentFrame:SetWidth(500);
  6. parentFrame:SetHeight(300);
  7. parentFrame:SetBackgroundColor(.1, .9, .1, 1);
  8.  
  9. -- error # 1
  10. do
  11.     local text = UI.CreateFrame("Text", "Test text", parentFrame);
  12.     text:SetPoint("TOP", parentFrame, "TOP", nil, 5);
  13.     text:SetPoint("LEFT", parentFrame, "LEFT", 5, nil);
  14.     text:SetPoint("RIGHT", parentFrame, "RIGHT", -5, nil);
  15.     text:SetBackgroundColor(.9, .1, .1, 1);
  16.     text:SetText("text");
  17.     text:ResizeToText();
  18.  
  19.     local highlight = UI.CreateFrame("Frame", "Test text highlight", parentFrame);
  20.     highlight:SetLayer(-1);
  21.     highlight:SetAllPoints(text);
  22.     highlight:SetBackgroundColor(.1, .1, .9, 1);
  23. end
  24.  
  25. -- error # 2
  26. do
  27.     local text = UI.CreateFrame("Text", "Test long text", parentFrame);
  28.     text:SetPoint("TOP", parentFrame, "TOP", nil, 100);
  29.     text:SetPoint("LEFT", parentFrame, "LEFT", 5, nil);
  30.     text:SetPoint("RIGHT", parentFrame, "RIGHT", -5, nil);
  31.     text:SetBackgroundColor(.9, .1, .1, 1);
  32.     text:SetWordwrap(true);
  33.     text:SetText("Integer vestibulum, libero ac facilisis ornare, enim lacus pharetra orci, quis scelerisque neque nisi id sem. Proin ultrices tellus quis justo tristique vestibulum aliquam ligula sagittis. Maecenas gravida, felis vel dictum iaculis, metus nisi pharetra ipsum, bibendum iaculis velit mi et est. Nam a dui in purus viverra porttitor in ac orci. Nunc lacinia mi vel justo vulputate a malesuada leo porta. Quisque suscipit posuere nulla, ac blandit libero pretium ut. Nam at suscipit neque.");
  34.     text:ResizeToText();
  35.  
  36.     local highlight = UI.CreateFrame("Frame", "Test long text highlight", parentFrame);
  37.     highlight:SetLayer(-1);
  38.     highlight:SetAllPoints(text);
  39.     highlight:SetBackgroundColor(.1, .1, .9, 1);
  40. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement