Originally Posted by Xrystal
Your code must still be missing something which is why I asked to see the code where you create your settings panel. How you create that will determine how you display it.
|
Sorry. Looks like I didn't see it. Here is the panel code.
Lua Code:
local addonName, addon = ...
-- Create a function to add options to the Interface Options Addons panel
local function AddAddonOptions()
local panel = CreateFrame("Frame", "MyAddonOptionsPanel", UIParent)
panel.name = "ZamestoTV: Gold" -- Replace "MyAddon" with your addon's name
-- Create a checkbox for QuestCompletionFrame
local completionCheckBox = CreateFrame("CheckButton", "QuestCompletionFrameCheckbox", panel, "InterfaceOptionsCheckButtonTemplate")
completionCheckBox:SetPoint("TOPLEFT", 16, -16)
completionCheckBox.Text:SetText("Enable Quest Completion Frame") -- Replace with your desired default text
completionCheckBox.tooltipText = "Enable the Quest Completion Frame" -- Replace with your desired default tooltip text
completionCheckBox:SetScript("OnClick", function(self)
local isChecked = self:GetChecked()
-- Handle the checkbox state change here
if isChecked then
-- Checkbox is checked, enable QuestCompletionFrame
QuestCompletionFrame:Show()
else
-- Checkbox is unchecked, disable QuestCompletionFrame
QuestCompletionFrame:Hide()
end
end)
-- Create a checkbox for ZAMTimer777 frame
local timerCheckBox = CreateFrame("CheckButton", "ZAMTimer777Checkbox", panel, "InterfaceOptionsCheckButtonTemplate")
timerCheckBox:SetPoint("TOPLEFT", completionCheckBox, "BOTTOMLEFT", 0, -8)
timerCheckBox.Text:SetText("Enable ZAMTimer777 Frame") -- Replace with your desired default text
timerCheckBox.tooltipText = "Enable the ZAMTimer777 Frame" -- Replace with your desired default tooltip text
timerCheckBox:SetScript("OnClick", function(self)
local isChecked = self:GetChecked()
-- Handle the checkbox state change here
if isChecked then
-- Checkbox is checked, enable ZAMTimer777 frame
ZAMTimer777:Show()
else
-- Checkbox is unchecked, disable ZAMTimer777 frame
ZAMTimer777:Hide()
end
end)
-- Add the panel to the Interface Options Addons category
InterfaceOptions_AddCategory(panel)
-- Handle language localization
local locale = GetLocale()
if locale == "deDE" then
-- German localization
completionCheckBox.Text:SetText("Aufgabenliste: Ein-/Ausblenden")
completionCheckBox.tooltipText = "Aufgabenliste: Ein-/Ausblenden"
timerCheckBox.Text:SetText("Timer: Ein-/Ausblenden")
timerCheckBox.tooltipText = "Timer: Ein-/Ausblenden"
panel.name = "ZamestoTV: Gold"
elseif locale == "enUS" then
-- English localization
completionCheckBox.Text:SetText("To Do List: Show/Hide")
completionCheckBox.tooltipText = "To Do List: Show/Hide"
timerCheckBox.Text:SetText("Timer: Show/Hide")
timerCheckBox.tooltipText = "Timer: Show/Hide"
panel.name = "ZamestoTV: Gold"
end
end
-- Register the addon-specific options when the player logs in
local frame = CreateFrame("FRAME")
frame:RegisterEvent("PLAYER_LOGIN")
frame:SetScript("OnEvent", function()
AddAddonOptions()
end)
I'm new to writing LUA, but I was advised to use ChatGPT (with the
help of it I was able to create the panel code and the "icons on the minimap" code)