Hide & Show button

How can I combine these two macros into one:

/run QuickJoinToastButton:Hide()
/run QuickJoinToastButton:Show()

I want on 1 key pres to either hide or show the button. Right now I have two separate macros and I want to combine them into one.

I don’t know if conditionals work with /run, but if they do you could try something like

/run [exists] QuickJoinToastButton:Hide()
/run [noexists] QuickJoinToastButton:Show()

which would alter its behavior depending on whether you have a target or not.

This doesn’t work. Creates an error

1 Like

I’d recommend doing a CVar toggle rather than manually hiding/showing the toasts.

/run local k,v = "showToastWindow" v = C_CVar.GetCVar(k) C_CVar.SetCVar(k, 1 - v) print(k .. (v == "1" and " Disabled" or " Enabled"))

[added]
If you just want to expand on what you’ve got you’ll want either :IsShown() or :IsVisible() for your test. I’m not sure which one is appropriate for this case.
https://wowpedia.fandom.com/wiki/API_ScriptRegion_IsShown

/run if QuickJoinToastButton:IsVisible() then QuickJoinToastButton:Hide() else QuickJoinToastButton:Show() end
3 Likes

This works for the toast and it doesn’t hide the button.

This did the job great. Thank you very much for the help

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.