That's the thing, it's mostly worked thus far. I think the dropdown might be a little out of it's league though.
That's where it seems to have the problems.
It seems to not be propagating the list of images for the dropdown menu. I'm not sure where to put this code. So far, everything else seems to be working right now. All I'm asking is where I would put the code for this to function right.
I need some help.
I’ve been working with ChatGDP trying to make my own version of something like kgpanels. Right now, I’m at a stuck point.
When we first started, I told it I wanted the addon to be able to create a frame when I pushed a button. It took a few hours, but we eventually figured it out and it was working correctly.
Well, then I told it I wanted to add a functional dropdown menu that would allow me to place art in those created frames. Then we couldn’t get the dropdown to work.
When we FINALLY got the dropdown to work, the button stopped working.
Can someone help and tell me where in this code, we messed it up (I also keep getting some errors with <eof>:
– Create the main frame and set its properties
local f = CreateFrame(“Frame”, “Jujupopup”, UIParent)
f:SetPoint(“CENTER”)
f:SetSize(512, 512)
f.tex = f:CreateTexture(nil, “BACKGROUND”)
f.tex:SetAllPoints()
f.tex:SetTexture(“Interface\Addons\JujuPanels\jujupopup.tga”)
f:SetMovable(true)
f:EnableMouse(true)
f:RegisterForDrag(“LeftButton”)
f:SetScript(“OnDragStart”, f.StartMoving)
f:SetScript(“OnDragStop”, f.StopMovingOrSizing)
– Define the function that creates a new frame
local function CreateNewFrame()
local newFrame = CreateFrame(“Frame”, “MyNewFrame”, UIParent)
newFrame:SetSize(200, 200)
newFrame:SetPoint(“CENTER”)
newFrame.texture = newFrame:CreateTexture(nil, “BACKGROUND”)
newFrame.texture:SetAllPoints(newFrame)
newFrame:SetMovable(true)
newFrame:EnableMouse(true)
newFrame:SetScript(“OnMouseDown”, function(self, button)
self:StartMoving()
end)
newFrame:SetScript(“OnMouseUp”, function(self, button)
self:StopMovingOrSizing()
end)
if f.selectedSkin ~= “none” then
skins[f.selectedSkin].func(newFrame)
end
end
– Create the button and set its properties
local button = CreateFrame(“Button”, nil, f, “UIPanelButtonTemplate”)
button:SetPoint(“CENTER”)
button:SetSize(128, 32)
button:SetText(“Create new frame”)
button:SetNormalTexture(“Interface\Addons\JujuPanels\button.tga”)
button:SetScript(“OnClick”, function()
CreateNewFrame()
end)
– Define the DropdownMenu object
local DropdownMenu = {}
function DropdownMenu.OnClick(self, arg1)
f.selectedSkin = arg1
end
function DropdownMenu.Populate(frame)
local info = {}
info.text = “Select a skin”
info.value = “none”
info.func = nil
UIDropDownMenu_AddButton(info, 1)
info = {}
info.text = “Skin 1”
info.value = “skin1”
info.func = DropdownMenu.OnClick
UIDropDownMenu_AddButton(info, 1)
info = {}
info.text = “Skin 2”
info.value = “skin2”
info.func = DropdownMenu.OnClick
UIDropDownMenu_AddButton(info, 1)
info = {}
info.text = “Skin 3”
info.value = “skin3”
info.func = DropdownMenu.OnClick
UIDropDownMenu_AddButton(info, 1)
end
– Create the dropdown menu frame and set its properties
f.skinDropdownFrame = CreateFrame(“Frame”, “SkinDropdownFrame”, f, “UIDropDownMenuTemplate”)
f.skinDropdownFrame:SetPoint(“BOTTOMLEFT”, button, “TOPLEFT”, 0, 5)
f.skinDropdownFrame.displayMode = “MENU”
f.skinDropdownFrame.initialize = DropdownMenu.Populate
– Set up the button’s click event
button:SetScript(“OnClick”, CreateNewFrame)
– Set the default skin
f.selectedSkin = “none”