Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

RIFT Textfield parent change bug

By: Dramiel on Nov 19th, 2011  |  syntax: Lua  |  size: 1.28 KB  |  views: 52  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. local context = _G.UI.CreateContext("Test context");
  2.  
  3. local container1 = _G.UI.CreateFrame("Frame", "Test container 1", context);
  4. container1:SetBackgroundColor(1, 0, 0, .5);
  5. container1:SetPoint("CENTER", _G.UIParent, "CENTER", -200, 0);
  6. container1:SetWidth(200);
  7. container1:SetHeight(300);
  8.  
  9. local container2 = _G.UI.CreateFrame("Frame", "Test container 2", context);
  10. container2:SetBackgroundColor(0, 1, 0, .5);
  11. container2:SetPoint("CENTER", _G.UIParent, "CENTER", 200, 0);
  12. container2:SetWidth(200);
  13. container2:SetHeight(300);
  14.  
  15. local textfield = _G.UI.CreateFrame("RiftTextfield", "Test textfield", container1);
  16. textfield:SetPoint("CENTER", container1, "CENTER", 0, 0);
  17. textfield:SetWidth(150);
  18. textfield:SetBackgroundColor(0, 0, 1, .5);
  19. textfield:SetText("Hello!");
  20.  
  21. container1.Event.LeftClick = function()
  22.         print("before" .. textfield:GetText());
  23.  
  24.         textfield:ClearPoint("CENTER");
  25.         textfield:SetParent(container1);
  26.         textfield:SetPoint("CENTER", container1, "CENTER", 0, 0);
  27.  
  28.         print("after" .. textfield:GetText());
  29. end
  30. container2.Event.LeftClick = function()
  31.         print("before" .. textfield:GetText());
  32.  
  33.         textfield:ClearPoint("CENTER");
  34.         textfield:SetParent(container2);
  35.         textfield:SetPoint("CENTER", container2, "CENTER", 0, 0);
  36.  
  37.         print("after" .. textfield:GetText());
  38. end
  39.  
clone this paste RAW Paste Data