SHARE
TWEET

RIFT Textfield parent change bug

Dramiel Nov 19th, 2011 55 Never
  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.  
RAW Paste Data
Top