View Single Post
06-01-19, 10:21 PM   #1
twin_tania
A Defias Bandit
Join Date: Jun 2019
Posts: 2
Show and Hide frames on button click

I recently started to learn LUA and have been slowly picking a few stuff up and currently am stuck trying to progress further with what I want to do. So far I've learned to create a frame, add a button, and a couple widgets to it. I've also been able to turn the button into something like a macro using SetAttribute("macrotext1", "/wave") but I have been unsuccessful trying to figure out how to press a button that shows a new frame while hiding the current frame. Basically like almost turning a page.

I have managed to create a new frame by pressing the button but this creates a new frame outside of the existing one by doing something like this.

Code:
frame.sBtn:SetScript("OnClick", function()
		local newFrames = CreateFrame("Frame", "DragFrame", UIParent, "TranslucentFrameTemplate")
		newFrames:SetWidth(150)
		newFrames:SetHeight(320)
		newFrames:SetFrameStrata("MEDIUM")
		newFrames:SetPoint("CENTER",  UIParent, "CENTER",0,-20)			
end)
But as mentioned this only created a brand new frame. I would appreciate any help or if there is somewhere I can get this info that is easy to digest. I tried looking at other addons but the amount of code inside those folders is very overwhelming since I am not quite sure what I need to be looking for.
  Reply With Quote