WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Anchoring Getting Confused .. (https://www.wowinterface.com/forums/showthread.php?t=56229)

Xrystal 05-19-18 04:25 AM

Anchoring Getting Confused ..
 
I have this block of code but the line pointed to insists that I am anchoring the button to itself but try as I might I can't see why as the idx is clearly different. Now a similar block of code that doesn't go on a second line works fine and I used that code as a base for this. The only difference between the buttons outside of their alignment is that the working block contains CheckButtons that aren't inherited from SecureActionButtonTemplate with checkbutton functionality for toggling whilst the one with problems are Buttons that are inherited from SecureActionButtonTemplate with a cooldown frame added, other than that they have the same base xml framework

The problem block that has 2 lines of buttons
Lua Code:
  1. local function InitialiseButtons()
  2.  
  3.     for idx = 1,10 do
  4.         local button = XMP_Main.ButtonFrame.Buttons[idx]
  5.         local prevButton = XMP_Main.ButtonFrame.Buttons[idx - 1]
  6.         if idx == 1 then
  7.             button:SetPoint("TOPLEFT",5,-5)
  8.         elseif idx == 6 then
  9.             button:SetPoint("BOTTOMLEFT",5,5)
  10.         else
  11.             button:SetPoint("TOPLEFT",prevButton,"TOPRIGHT",5,0)   -- < HERE
  12.         end
  13.         button:SetWidth(48)
  14.         button:SetHeight(48)
  15.         button:Show()
  16.     end
  17.  
  18. end

This is the code I used as a basis for the one above .. this one does a straight line of x buttons and works completely fine
Lua Code:
  1. local idx = 1
  2.     for i,v in pairs(addonData.TaxiMaps) do
  3.         local button = frame.Buttons[idx]
  4.         local prevButton = frame.Buttons[idx-1]
  5.         if idx == 1 then
  6.             button:SetPoint("LEFT",10,0)
  7.         else
  8.             button:SetPoint("TOPLEFT",prevButton,"TOPRIGHT", 5, 0)
  9.         end
  10.         idx = idx + 1
  11.     end

It's bound to be something really simple that is staring me in the face but I can't see it at all so any help is appreciated.

Xrystal 05-19-18 05:38 AM

Problem Cause and Solution ...
 
Well it seems that parentArray cannot be used on both the inherited frame and the frame inheriting it ..

Code:

    <Button name = "XMP_IconTemplate" parentArray = "Buttons" virtual = "true">
        <Size x="40" y="40"/>

        <Layers>
            <Layer level="BACKGROUND">
                <Texture parentKey="Icon" />
            </Layer>
        </Layers>

        <NormalTexture parentKey="NormalTexture" file="Interface\Buttons\UI-EmptySlot" setAllPoints = "true"/>
        <PushedTexture parentKey ="PushedTexture" file="Interface\Buttons\CheckButtonHilight" alphaMode = "ADD" setAllPoints = "true"/>
        <HighlightTexture parentKey = "HighlightTexture" file="Interface\Buttons\CheckButtonHilight"  alphaMode = "ADD" setAllPoints = "true"/> 
    </Button>

Code:

    <Button name = "XMP_SpellButtonTemplate" inherits = "XMP_IconTemplate,SecureActionButtonTemplate" virtual = "true">

        <Frames>
            <Cooldown inherits="CooldownFrameTemplate" parentKey="Cooldown" />
        </Frames>

    </Button>

If I add the parentArray descriptor to the SpellButtonTemplate then I get the anchoring to itself error message. If I remove it everything works as expected.


All times are GMT -6. The time now is 01:31 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI