LAM Control setup (Iconpicker)
Hey, I ran into an issue that I don't understand. Here is the code:
Code:
local iconSelect = LAMCreateControl.iconpicker(parent, { And another question concerning LAM's iconpicker: Is there any way to preselect an icon from the list for the button? The path is saved insinde the saved variables. Cheers, Letho |
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
|
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. |
Thank you for your answers!
Quote:
Quote:
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) Additionally: Code:
iconSelect:SetWidth() --does indeed do nothing Code:
iconSelectReference:UpdateValue() Code:
iconSelectReference.icon:SetTexture(path) |
Simply specifying "self" is not returning the icon.
You need to let it return the SavedVariables data where the selected icon from the iconpicker is stored. e.g. function AuraMastery.EditAuraIcon(value) AuraMastery.svars.auraData[activeAura].iconPath = value end getFunc = function() return AuraMastery.svars.auraData[activeAura].iconPath end, setFunc = function(value) AuraMastery.EditAuraIcon(value) end, Quote:
The default values just need to be an array/table with all your possible saved variables as default values, which you use at the SavedVariables creation as the default values/fallback values if the real saved variables are missing (new savedvars version, new addon, settings = nil ...) Setting the default values at lam controls will let you use the "Set back to defaults" button fo all the LAM controls e.g. The getfunc will try to read the savedvars and if nothing is found (= nil) it will use the default value. If the default value is the same that you use for the SavedVars creation the settings probably won't be nil, as they got copied from the defaults. So the getfunc will just automatically use the default variable which is stored in the savedvars now. |
Quote:
Quote:
Quote:
The controls on the right side of the menu are all precreated and hidden. As soon as the user "selects" an aura from the left menu it's name is saved to the addons "global" table (AuraMastery.activeAura = auraName), the editboxes will be filled with the appropriate text values and all menu controls will be displayed. If controls are not used, they are simply anchored to an invisible pool-control - the "control structure", meaning which control to display on what position is saved into an array containing the appropriate values. |
If you save the path of the selected icon, coming from the value parameter of the setFunc of the icon picker, to
AuraMastery.svars.auraData[AuraMastery.activeAura].iconPath you can use the getfunc to get the icon's path that was saved return AuraMastery.svars.auraData[AuraMastery.activeAura].iconPath And the same for the default icon path, if you have a default specified somewhere. The controls are not inside a LAM panel as it seems (correct?) and thus won't get updated automatically via the getFunc I guess. Maybe you need to set the texture manually to the iconpicker by using the reference of the LAM control and use something like WINDOW_MANAGER:GetControlByName(reference, "").icon:SetTexture(AuraMastery.svars.auraData[AuraMastery.activeAura].iconPath) ? |
As I wrote above, that's the way I do it^^
|
All times are GMT -6. The time now is 10:46 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI