I'm a beginner when it comes to addon development...
I created a simple addon with a frame and a button but the button is not showing up on the frame.
I've looked at a few other examples but can't see what I'm doing wrong.
I have bug sack/bug grabber enabled and not seeing any errors.
Any help is much appreciated.
Here is my lua file.
Lua Code:
-- Load the AceGUI and LibDBIcon libraries
local AceGUI = LibStub("AceGUI-3.0")
local LibDBIcon = LibStub("LibDBIcon-1.0")
-- Create a new frame
local frame = AceGUI:Create("Frame")
frame:SetTitle("MyAddon Frame")
frame:SetStatusText("Example Status Text")
frame:SetCallback("OnClose", function(widget) AceGUI:Release(widget) end)
frame:SetLayout("Flow")
frame:Hide()
-- Create a button
local button = AceGUI:Create("Button")
button:SetText("Click Me!")
button:SetWidth(200)
button:SetCallback("OnClick", function() print("Button Clicked!") end)
-- Add the button to the frame
frame:AddChild(button)
-- Create a minimap button
local showFrame = false
local icon = LibDBIcon:Register("MyAddon", {
icon = "Interface\\Icons\\Ability_Marksmanship",
OnClick = function(self, button)
if button == "LeftButton" then
frame:Show()
elseif button == "RightButton" then
frame:Hide()
end
end,
OnTooltipShow = function(tooltip)
tooltip:SetText("MyAddon")
tooltip:AddLine("Left-click to open", 1, 1, 1)
tooltip:AddLine("Right-click to close", 1, 1, 1)
end,
})
-- Register the addon
local addonName, addonTable = ...
addonTable.frame = frame