View Single Post
05/08/17, 08:46 AM   #4
Letho
AddOn Author - Click to view addons
Join Date: Apr 2016
Posts: 238
Thank you for your answers!

Originally Posted by rullof View Post
The error is comming either fron getFunc or setFunc make sure you're calling your function using : and check if EditAuraIcon doesnt have any errors
It was indeed the GetFunc though I have no idea what actually caused the error, I leave it to be an empty function now. (According to LAM's code the getFunc should return the currently selected icon's texture path, allthough this does not work in my case :/).


Originally Posted by sirinsidiator View Post
iconSelect is not a ZOS control. You cannot call SetWidth, ClearAnchors and SetAnchor on it directly. Instead you need to access iconSelect.container.
You can set an initial icon via the "default" property on the data table.

According to zgoo iconSelect is of type #userData :O
This is the code in LibAddonMenu-2.0.lua where it is created:
Code:
local function CreateBaseControl(parent, controlData, controlName)
    local control = wm:CreateControl(controlName or controlData.reference, parent.scroll or parent, CT_CONTROL)
    control.panel = parent.panel or parent -- if this is in a submenu, panel is the submenu's parent
    control.data = controlData

    control.isHalfWidth = controlData.width == "half"
    local width = 510 -- set default width in case a custom parent object is passed
    if control.panel.GetWidth ~= nil then width = control.panel:GetWidth() - 60 end
    control:SetWidth(width)
    return control
end
So isn't it a ZOS control of type CT_CONTROL?

Additionally:
Code:
iconSelect:SetWidth() --does indeed do nothing
iconSelect.container:SetAnchor() --does not do nothing aswell
iconSelect.SetAnchor(TOPLEFT, parent, TOPLEFT) --is working as intended
Regarding preSelection: I tried using
Code:
iconSelectReference:UpdateValue()
, but it is a local function and only called upon the control's creation. I'm now using

Code:
iconSelectReference.icon:SetTexture(path)
I basically needed the icon to dynamically change to the path returned by a function that is called on clicking another button that selects the aura to be currently edited. This active aura's path is stored in AuraMastery.svars.auraData[activeAura].iconPath.

Last edited by Letho : 05/08/17 at 09:10 AM.
  Reply With Quote