WoWInterface - View Single Post - Show and Hide frames on button click
View Single Post
06-01-19, 11:28 PM   #3
I did that?
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,310
Lua Code:
  1. frame.sBtn:SetScript("OnClick", function(self)
  2.     newFrame:SetShown(not newFrame:IsShown())  
  3. end)

Essentially, change the frame's shown state to what it is not now.

If you wanted to hide frame at the same time, add
self:GetParent():SetShown(not self:GetParent()IsShown())
to the above script. This assumes you have created the button (sBtn) with "frame" as its parent.

If you have a button on newFrame to toggle back, use the same script in its OnClick handler only replace newFrame with frame
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 06-02-19 at 06:15 AM.
  Reply With Quote