Lua Code:
local function SUICreateTXT(text,anchor,point,pos1,pos2, ...)
SUITXT = SUI:CreateFontString(nil, SUIConfig, "GameFontNormalLarge")
SUITXT:SetPoint(point, anchor, pos1, pos2)
SUITXT:SetText(text)
end
local function SUICreateCB(name,anchor,tooltip,db, ...)
SUICheckbox = CreateFrame("CheckButton", nil , SUIConfig,"OptionsBaseCheckButtonTemplate")
SUICheckbox:SetPoint("TOPLEFT", anchor, "BOTTOMLEFT", 0, -10)
SUICheckbox:SetScript(
"OnClick",
function(frame)
local tick = frame:GetChecked()
db = tick
if tick then
DEFAULT_CHAT_FRAME:AddMessage(name .. " Enabled", 0, 1, 0)
db = true
else
DEFAULT_CHAT_FRAME:AddMessage(name .. " Disabled", 1, 0, 0)
db = false
end
end
)
SUICheckbox:SetScript(
"OnShow",
function(frame)
frame:SetChecked(db)
end
)
SUICheckbox:SetScript(
"OnEnter",
function(self)
GameTooltip:SetOwner(self, "ANCHOR_BOTTOM")
GameTooltip:AddLine("test", 248, 248, 255)
GameTooltip:Show()
end
)
SUICheckbox:SetScript("OnLeave", GameTooltip_Hide)
text = SUI:CreateFontString(nil, SUIConfig, "GameFontHighlight")
text:SetPoint("LEFT", SUICheckbox, "RIGHT", 0, 1)
text:SetText(name)
end
--UI
SUICreateTXT("UI",SUIConfig,"TOPLEFT",20,-75)
SUICreateCB("Unitframes",SUITXT,"test",SUIDB.UNITFRAMES)
SUICreateCB("Castbars",SUICheckbox,"test2",SUIDB.CASTBARS)
SUICreateCB("Keys",SUICheckbox,"test3",SUIDB.KEYS)
SUICreateCB("Gryphons",SUICheckbox,"test3",SUIDB.KEYS)
hey, i want to change a savedvariable with "db = true" in the "SUICreateCB" function is it not possible or do i something wrong?
hope someone can help me thx