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:
local gridFrame = CreateFrame("Frame", "DragFrame2", UIParent)
gridFrame:SetMovable(true)
gridFrame:EnableMouse(true)
gridFrame:RegisterForDrag("LeftButton")
gridFrame:SetScript("OnDragStart", gridFrame.StartMoving)
gridFrame:SetScript("OnDragStop", gridFrame.StopMovingOrSizing)
-- The code below makes the frame visible, and is not necessary to enable dragging.
gridFrame:SetPoint("CENTER"); gridFrame:SetWidth(300); gridFrame:SetHeight(300);
local gridFrameTexture = gridFrame:CreateTexture("ARTWORK");
gridFrameTexture:SetAllPoints();
gridFrameTexture:SetColorTexture(0.89,0.44,0.1, 0.5)
-- SubFrame
local subFrame = CreateFrame("Button", "subFrame", UIParent)
local texture = subFrame:CreateTexture("ARTWORK")
subFrame:SetWidth(300); subFrame:SetHeight(50);
texture:SetAllPoints()
texture:SetColorTexture(1,0,0.1, 1)
local fontString = subFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
fontString:SetPoint("CENTER")
fontString:SetText("hej")
subFrame:SetPoint("TOP", gridFrame, "TOP", 0,0)
How would i go about this?