Thread: Slash Commands
View Single Post
04-03-16, 09:17 PM   #11
Uitat
A Chromatic Dragonspawn
 
Uitat's Avatar
AddOn Author - Click to view addons
Join Date: May 2011
Posts: 162
ok this is something i used for my config base frame now your main frame to hide all would be in the place of config_BaseFrame

also note i nested this to my topFrame and the toggle for it was a button, when i clicked the button it activated this code, just a little example, most here could find a cleaner way to do it but this worked for me...

if you want to gut my original code for your own use you can check it out at Project Deranjata here on WI. the file it is located in is config.lua


Code:
function MyAddon_ShowOptionFrame()
	--[[ Does the frame already exist?]]
	if not Config_BaseFrame then
		--[[ Nope. Create it now:]]
		CreateFrame("frame", "Config_BaseFrame", UIParent)
		Config_BaseFrame:SetWidth(1024)
		Config_BaseFrame:SetHeight(512)
		Config_BaseFrame:SetPoint("CENTER", UIParent,"CENTER")
		Config_BaseFrame:SetFrameStrata("HIGH")
		--[[	MAKE THE FRAME MOVEABLE ON RIGHT CLICK]]
		Config_BaseFrame:SetMovable(true)
		Config_BaseFrame:EnableMouse(true)
		Config_BaseFrame:SetScript("OnMouseDown", function(self, button)
			if button == "RightButton"
				and not self.isMoving
				then
					self:StartMoving()
					self.isMoving = true
				end
			end)
			Config_BaseFrame:SetScript("OnMouseUp", function(self, button)
				if button == "RightButton"
					and self.isMoving
					then
						self:StopMovingOrSizing()
						self.isMoving = false
					end
				end)
				Config_BaseFrame:SetScript("OnHide", function(self)
					if ( self.isMoving )
						then
							self:StopMovingOrSizing()
							self.isMoving = false
						end
					end)


				else
					--[[ frame already exists, so toggle it.]]
					Config_BaseFrame:SetShown(not Config_BaseFrame:IsShown())
				end
__________________

Last edited by Uitat : 04-03-16 at 09:23 PM.
  Reply With Quote