Thread Tools Display Modes
05-19-18, 04:25 AM   #1
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,917
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.
__________________
  Reply With Quote
05-19-18, 05:38 AM   #2
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,917
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.
__________________
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Anchoring Getting Confused ..

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