View Single Post
09-06-09, 11:25 PM   #60
Katae
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Jun 2007
Posts: 208
Originally Posted by Miralen View Post
I have two panels one on the right and one on the left and I want them to be positioned let's say 10% away from the side of the screen and bottom of the screen.
So I want to get this right, you want x and y pos to be a percentage of the width and height of your screen? You could use this function as your panel's OnLoad handler:
Code:
OnLoad = function(self)
	local width, height = UIParent:GetWidth(), UIParent:GetHeight()
	-- percentage; set percentX to negative if panel is
	-- anchored to RIGHT side, percentY if anchored to TOP
	local percentX, percentY = 0.10, 0.10
	local points = {self:GetPoint()}
	points[4], points[5] = width * percentX, height * percentY
	self:ClearAllPoints()
	self:SetPoint(unpack(points))
end

Last edited by Katae : 09-06-09 at 11:29 PM.
  Reply With Quote