View Single Post
03-20-19, 09:27 AM   #1
wille480
A Wyrmkin Dreamwalker
Join Date: Jan 2017
Posts: 56
Position frames inside gridPanel

Hello, so i am trying to make a function that will create a frame and position it inside my grid panel. I have the code to create one frame and position it how i want, but i can't find a way to create a function that will create a frame and position it into the gridpanel below another frame that would have previous been created.

This is how it currently looks:
https://gyazo.com/205ec8741ee64a55ace2fff7a6c21653

I am pleased how it looks so far but now i need to find a way for a function like this that will position frames below eachother but still being inside the orange panel.

My current code:

Lua Code:
  1. local gridFrame = CreateFrame("Frame", "DragFrame2", UIParent)
  2. gridFrame:SetMovable(true)
  3. gridFrame:EnableMouse(true)
  4. gridFrame:RegisterForDrag("LeftButton")
  5. gridFrame:SetScript("OnDragStart", gridFrame.StartMoving)
  6. gridFrame:SetScript("OnDragStop", gridFrame.StopMovingOrSizing)
  7. -- The code below makes the frame visible, and is not necessary to enable dragging.
  8. gridFrame:SetPoint("CENTER"); gridFrame:SetWidth(300); gridFrame:SetHeight(300);
  9. local gridFrameTexture = gridFrame:CreateTexture("ARTWORK");
  10. gridFrameTexture:SetAllPoints();
  11. gridFrameTexture:SetColorTexture(0.89,0.44,0.1, 0.5)
  12.  
  13. -- SubFrame
  14. local subFrame = CreateFrame("Button", "subFrame", UIParent)
  15. local texture = subFrame:CreateTexture("ARTWORK")
  16. subFrame:SetWidth(300); subFrame:SetHeight(50);
  17. texture:SetAllPoints()
  18. texture:SetColorTexture(1,0,0.1, 1)
  19. local fontString = subFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
  20. fontString:SetPoint("CENTER")
  21. fontString:SetText("hej")
  22. subFrame:SetPoint("TOP", gridFrame, "TOP", 0,0)

How would i go about this?
  Reply With Quote