frame sizes
I have a frame in a mod I'm working on. It's set to parent="UIParent"
and has the size set to relative with x="1" and y="1". When I query GetWidth() and GetHeight() on my frame, it returns 1280 plus a small fraction for both. Doing the same for UIParent I get the expected 1024 x 768 which is what my current resolution is set to. Is there a simple way to make sure my frame matches the size and position of it's parent (in this case UIParent, or possibly WorldFrame)? |
You can set anchors instead of width/height.
In lua: frame:ClearAllPoints() -- removes all anchors frame:SetPoint("TOPLEFT","UIParent","TOPLEFT") frame:SetPoint("BOTTOMRIGHT","UIParent","BOTTOMRIGHT") in xml: <Anchors> <Anchor point="TOPLEFT" relativeTo="UIParent" relativePoint="TOPLEFT"/></Anchors> This will stretch the frame to cover the whole screen even if it resizes. I commonly use this to stretch a background texture in a frame. Once anchored to both corners there's no need to go back to it if I change the size of the window. |
All times are GMT -6. The time now is 04:44 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI