View Single Post
03-17-24, 10:47 AM   #5
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,892
Originally Posted by Hubb777 View Post
Second question
how can I make a button to hide the timer on command?
Lua Code:
  1. SLASH_HUBB1 = "/hubb"
  2. SlashCmdList["HUBB"] = function(msg)
  3.     if strupper(strtrim(msg)) == "BTN" then -- toggle the shown state of the button if the type /hubb btn
  4.         btn:SetShown(not btn:IsShown()) -- show the button
  5.         return
  6.     end
  7.     updateData()
  8.     updateList()
  9.     f:Show()
  10. 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:
  1. SLASH_HUBB1 = "/hubb"
  2. SlashCmdList["HUBB"] = function(msg)
  3.     if strupper(strtrim(msg)) == "BTN" then -- toggle the shown state of the button if the type /hubb btn
  4.         ZAMTimer777:SetShown(not ZAMTimer777:IsShown()) -- show the button
  5.         return
  6.     end
  7.     updateData()
  8.     updateList()
  9.     ZAMTimer777:Show()
  10. end
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote