Quantcast
Button to dynamically resize a parent frame? - WoWInterface
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
10-04-19, 09:47 AM   #1
Zax
A Cliff Giant
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 72
Button to dynamically resize a parent frame?

Hello,

I'm trying to make a handler in the bottom right of a main frame in order to dynamically resize this frame and its contents.
With the following script, only the main frame is resized, not its content (all its children, like subframes, buttons, etc).
I guess I forgot something important...
Code:
frame:SetClampedToScreen(true)
frame:SetMovable(true)
frame:SetUserPlaced(true)
frame:SetResizable(true)
frame:SetMaxResize(frame.width * 1.5, frame.height * 1.5)
frame:SetMinResize(frame.width / 1.5, frame.height / 1.5)

local handlerBtn = CreateFrame("Button", "$parent_handler", frame)
handlerBtn:SetSize(16, 16)
handlerBtn:SetPoint("TOPLEFT", frame, "BOTTOMRIGHT", -16, 16)
local texture = handlerBtn:CreateTexture(nil,"BACKGROUND")
texture:SetAllPoints(true)
texture:SetColorTexture(1, 0, 0, 0.6)
handlerBtn.texture = texture

handlerBtn:EnableMouse(true)
handlerBtn:SetScript("OnMouseDown", function(self, mouse)
	if (mouse == "LeftButton" and not frame.isResizing) then
		self:GetParent().isResizing = true;
		self:GetParent():StartSizing("BOTTOMRIGHT")
	end
end)
handlerBtn:SetScript("OnMouseUp", function(self, mouse)
	if (mouse == "LeftButton" and frame.isResizing) then
		self:GetParent():StopMovingOrSizing()
		self:GetParent().isResizing = false
	end
end)
Thank you.
  Reply With Quote
 

WoWInterface » Developer Discussions » General Authoring Discussion » Button to dynamically resize a parent frame?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off