Help with Check Boxes

Hello,

I have added my addon to the Interface Options panel. I created a check box to toggle a setting. However, when clicking on the checkbox nothing happens. I was expecting it be toggle between checked and unchecked.

local blackOxStatueButton = CreateFrame(“Button”, “Hyperspawn_Interface_Child_Alerts_blackOxStatue”, Hyperspawn_UI.childpanel_Alerts, “UICheckButtonTemplate”)
blackOxStatueButton:SetPoint(“TOP”,-290,-5)
blackOxStatueButton.text:SetText(“Black Ox Statue”)

I have tried to add a SetScript action to the check button as well but it didn’t make a difference.

blackOxStatueButton:SetScript(“OnClick”, function()
if blackOxStatueButton:GetChecked() == true then
print(“Button is checked”)
else
print(“Button is unchecked”)
end
end)

Thank you.

Yeah don’t mind my previous edited out post. The widget should be checkbutton instead of button

CreateFrame("CheckButton", nil, nil, "UICheckButtonTemplate")
1 Like

Thank you for the information. That seemed to do the trick!

Any idea why the FontString:SetText not working? It causes the rest of the addon to not load.

blackOxStatueFontString = Hyperspawn_UI.childpanel_Alerts:CreateFontString()
blackOxStatueFontString:SetPoint(“TOP”,-285,-30)
blackOxStatueFontString:SetText(“String”)

FontStrings need a font SetFont(). You should be getting an error saying one hasn’t been set.

Thank you. Do you happen to know what the default font is for the addon interface panel or where I can find a list of fonts?

EDIT: Oops, I forgot to also ask how do you turn on logging? I didn’t receive an error message about the font not being set.

For the most part for labels it’s GameFontHighlight but it depends on how you want your option(s) to display.

For debugging errors, install:
https://www.curseforge.com/wow/addons/bug-grabber
and
https://www.curseforge.com/wow/addons/bugsack