Originally Posted by Hubb777
Second question
how can I make a button to hide the timer on command?
Lua Code:
SLASH_HUBB1 = "/hubb" SlashCmdList["HUBB"] = function(msg) if strupper(strtrim(msg)) == "BTN" then -- toggle the shown state of the button if the type /hubb btn btn:SetShown(not btn:IsShown()) -- show the button return end updateData() updateList() f:Show() end
|
Your code doesn't contain a
btn to hide/show.
You want to hide/show the frame that you created and for that (in this case) you would use the frame name
ZAMTimer777. If you are giving frames a name then each one should be completely unique (like using your addon name as a prefix eg. "
ZAMTimer_No1" or "
Hubb777_Addon_A" etc.)
Lua Code:
SLASH_HUBB1 = "/hubb"
SlashCmdList["HUBB"] = function(msg)
if strupper(strtrim(msg)) == "BTN" then -- toggle the shown state of the button if the type /hubb btn
ZAMTimer777:SetShown(not ZAMTimer777:IsShown()) -- show the button
return
end
updateData()
updateList()
ZAMTimer777:Show()
end