03-09-09, 12:36 AM | #1 |
Problem With Multiple Anchors
EDIT: I solved this by going a different route: Instead of anchoring each piece to other pieces, I anchored all pieces to the parent, and offset based on the sizes of corner pieces.
What I'm trying to do is have multiple textures make up a window that'll change sizes constantly. I'm using nine different textures (left, center, right by top, middle, bottom). The four corners are anchored to the corners of the parent. The two sides are anchored to the textures above and below. The top and bottom are anchored to the textures on their sides. The middle center texture is anchored to the four points of the two textures to it's side. What should happen is: I set the parent frame's width and height, and the edge textures (not corners) change to fit in between the corner textures. The middle center texture should fill in the remaining space. Something's wrong, though, and I can't figure out what... Code:
<Frame name="MyAddonFrame" parent="UIParent" framelevel="1"> <Layers> <Layer level="BACKGROUND"> <!--Top Left--> <Texture name="$Parent_TopLeftTexture" file="Interface\Addons\MyAddon\Images\top-left.tga"> <Size> <AbsDimension x="80" y="76"/> </Size> <Anchors> <Anchor point="TOPLEFT" relativeTo="$Parent" relativePoint="TOPLEFT"/> </Anchors> <TexCoords left="0" right="0.625" top="0" bottom="0.59375"/> <!--80/128 x 76/128--> </Texture> <!--Top Center--> <Texture name="$Parent_TopCenterTexture" file="Interface\Addons\MyAddon\Images\top-center.tga"> <Size> <AbsDimension x="112" y="76"/> </Size> <Anchors> <Anchor point="TOPLEFT" relativeTo="$Parent_TopLeftTexture" relativePoint="TOPRIGHT"/> <Anchor point="TOPRIGHT" relativeTo="$Parent_TopRightTexture" relativePoint="TOPLEFT"/> </Anchors> <TexCoords left="0" right="0.9296875" top="0" bottom="0.59375"/> <!--476/512 x 76/128--> </Texture> <!--Top Right--> <Texture name="$Parent_TopRightTexture" file="Interface\Addons\MyAddon\Images\top-right.tga"> <Size> <AbsDimension x="38" y="76"/> </Size> <Anchors> <Anchor point="TOPRIGHT" relativeTo="$Parent" relativePoint="TOPRIGHT"/> </Anchors> <TexCoords left="0" right="0.59375" top="0" bottom="0.59375"/> <!--38/64 x 76/128--> </Texture> <!--Middle Left--> <Texture name="$Parent_MiddleLeftTexture" file="Interface\Addons\MyAddon\Images\middle-left.tga"> <Size> <AbsDimension x="25" y="180"/> </Size> <Anchors> <Anchor point="TOPLEFT" relativeTo="$Parent_TopLeftTexture" relativePoint="BOTTOMLEFT"/> <Anchor point="BOTTOMLEFT" relativeTo="$Parent_BottomLeftTexture" relativePoint="TOPLEFT"/> </Anchors> <TexCoords left="0" right="0.78125" top="0" bottom="0.67578125"/> <!--25/32 x 173/256--> </Texture> <!--Middle Center--> <Texture name="$Parent_MiddleCenterTexture" file="Interface\Addons\MyAddon\Images\middle-center.tga"> <Size> <!--<AbsDimension x="180" y="180"/>--> </Size> <Anchors> <Anchor point="TOPLEFT" relativeTo="$Parent_MiddleLeftTexture" relativePoint="TOPRIGHT"/> <Anchor point="BOTTOMLEFT" relativeTo="$Parent_MiddleLeftTexture" relativePoint="BOTTOMRIGHT"/> <Anchor point="TOPRIGHT" relativeTo="$Parent_MiddleRightTexture" relativePoint="TOPLEFT"/> <Anchor point="BOTTOMRIGHT" relativeTo="$Parent_MiddleRightTexture" relativePoint="BOTTOMLEFT"/> </Anchors> <TexCoords left="0" right="1.0" top="0" bottom="1.0"/> <!--256 x 256--> </Texture> <!--Middle Right--> <Texture name="$Parent_MiddleRightTexture" file="Interface\Addons\MyAddon\Images\middle-right.tga"> <Size> <AbsDimension x="25" y="180"/> </Size> <Anchors> <Anchor point="TOPRIGHT" relativeTo="$Parent_TopRightTexture" relativePoint="BOTTOMRIGHT"/> <Anchor point="BOTTOMRIGHT" relativeTo="$Parent_BottomRightTexture" relativePoint="TOPRIGHT"/> </Anchors> <TexCoords left="0" right="0.78125" top="0" bottom="0.67578125"/> <!--25/32 x 173/256--> </Texture> <!--Bottom Left--> <Texture name="$Parent_BottomLeftTexture" file="Interface\Addons\MyAddon\Images\bottom-left.tga"> <Size> <AbsDimension x="116" y="40"/> </Size> <Anchors> <Anchor point="BOTTOMLEFT" relativeTo="$Parent" relativePoint="BOTTOMLEFT"/> </Anchors> <TexCoords left="0" right="0.90625" top="0" bottom="0.625"/> <!--116/128 x 40/64--> </Texture> <!--Bottom Center--> <Texture name="$Parent_BottomCenterTexture" file="Interface\Addons\MyAddon\Images\bottom-center.tga"> <Size> <AbsDimension x="30" y="40"/> </Size> <Anchors> <Anchor point="TOPLEFT" relativeTo="$Parent_BottomLeftTexture" relativePoint="TOPRIGHT"/> <Anchor point="TOPRIGHT" relativeTo="$Parent_BottomRightTexture" relativePoint="TOPLEFT"/> </Anchors> <TexCoords left="0" right="0.556640625" top="0" bottom="0.625"/> <!--285/512 x 40/64--> </Texture> <!--Bottom Right--> <Texture name="$Parent_BottomRightTexture" file="Interface\Addons\MyAddon\Images\bottom-right.tga"> <Size> <AbsDimension x="84" y="40"/> </Size> <Anchors> <Anchor point="BOTTOMRIGHT" relativeTo="$Parent" relativePoint="BOTTOMRIGHT"/> </Anchors> <TexCoords left="0" right="0.65625" top="0" bottom="0.625"/> <!--84/128 x 40/64--> </Texture> </Layer> </Layers> <!--Initial Size--> <Size> <AbsDimension x="230" y="296"/> </Size> <Anchors> <Anchor point="CENTER"/> </Anchors> </Frame> But after executing Code:
/script MyAddonFrame:SetWidth(300) /script MyAddonFrame:SetHeight(400) Anyone know why the multiple anchor points aren't working? I've tried removing the <Size> tags, but then the textures just show up full sized (still ignoring additional anchors). Last edited by Exawatt : 03-11-09 at 01:48 PM. Reason: Fixed it myself |
|
WoWInterface » Developer Discussions » Lua/XML Help » Problem With Multiple Anchors |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Switch to Linear Mode |
Switch to Hybrid Mode |
Threaded Mode |
|
|