05/11/14, 05:12 AM | #1 |
|
Too many anchors - options menu
Hello,
I know there's already a similar thread to this one, but it did not seem to be the same issue and I do not want to hijack their thread. I started working on my options panel and today I ran across this error - UI Error - "Too many anchors processed." That is all it says. No reference to how it got to that point. I sometimes get another one talking about a child out of range with Fit Descendants. It does not happen all the time and I've changed my code multiple times, so I do not have the exact wording of it anymore. The 2nd error could potentially have been from a code change as well, but figure I'd mention it just in case it helps. Now, the anchor error only happens when I actually select my options panel and thus make it visible. So, as far as I can tell, the creation of the options panel is what is causing it. The only addons I have turned on is the one I'm working on and zgoo. I only have 2 headers, a checkbox with a label, a slider with a label, and 1 color picker being created at the moment. I had 5 color picker's which were successfully being created prior to this error happening, but I turned them off for now. This started when I changed my checkbox creation (which is the 2nd object created, the first being a header or section title) from: Code:
function _NST:CreateOptionsCheckbox() NST.optionsWindow.testCheckbox = WM:CreateControlFromVirtual("NST_TEST_CHECKBOX", ZO_OptionsWindowSettingsScrollChild, "ZO_Options_Checkbox") NST.optionsWindow.testCheckbox:ClearAnchors() NST.optionsWindow.testCheckbox:SetAnchor(TOPLEFT,NST.optionsWindow.header,BOTTOMLEFT, 0, 6) NST.optionsWindow.testCheckbox.controlType = OPTIONS_CHECKBOX NST.optionsWindow.testCheckbox.system = SETTING_TYPE_UI NST.optionsWindow.testCheckbox.settingId = _G[string.format("SETTING_NST_TEST_CHECKBOX")] NST.optionsWindow.testCheckbox.panel = _G["NST_OPTIONS_WINDOW"] NST.optionsWindow.testCheckbox.text = "Test Layout" NST.optionsWindow.testCheckbox.tooltipText = "Test text" NST.optionsWindow.testCheckbox.button = NST.optionsWindow.testCheckbox:GetNamedChild("Checkbox") -- Set saved variable OnClicked ZO_PreHookHandler(NST.optionsWindow.testCheckbox.button, "OnClicked", function() self:SetTestCheckbox() end) -- Warning icon and tooltip to show a reload is needed for this setting NST.optionsWindow.testCheckbox.warning = WM:CreateControlFromVirtual("NST_TEST_CHECKBOX_WARNING", NST.optionsWindow.testCheckbox, "ZO_Options_WarningIcon") NST.optionsWindow.testCheckbox.warning:SetAnchor(RIGHT, NST.optionsWindow.testCheckbox.button, LEFT, -5, 0) NST.optionsWindow.testCheckbox.warning.tooltipText = "You need to reload the UI after changing this option" -- Shows the final control ZO_OptionsWindow_InitializeControl(NST.optionsWindow.testCheckbox) end Code:
function _NST:CreateOptionsCheckbox() NST.optionsWindow.goldCheckbox = self:CreateControlCheckbox("NST_Options_Checkbox_Gold",NST.optionsWindow.header,"Gold Carried","Sets the gold carried window to active or disabled",nil,nil,true,"You need to reload the UI after changing this option") end Code:
function _NST:CreateControlCheckbox(controlName,controlParent,text,tooltipText,getFunc,setFunc,warning,warningText) local checkbox = WM:CreateControlFromVirtual(controlName,ZO_OptionsWindowSettingsScrollChild, "ZO_Options_Checkbox") checkbox:ClearAnchors() checkbox:SetAnchor(TOPLEFT,controlParent,BOTTOMLEFT,0,6) checkbox.controlType = OPTIONS_CHECKBOX checkbox.system = SETTING_TYPE_UI checkbox.settingId = _G[string.format("SETTING_%s",controlName)] checkbox.panel = _G["NST_OPTIONS_WINDOW"] checkbox.text = text checkbox.tooltipText = tooltipText checkbox.button = checkbox:GetNamedChild("Checkbox") -- Set saved variable OnClicked ZO_PreHookHandler(checkbox.button, "OnClicked", function() self:SetTestCheckbox() end) -- Warning icon and tooltip to show a reload is needed for this setting if warning then checkbox.warning = WM:CreateControlFromVirtual(controlName.."WarningIcon",checkbox,"ZO_Options_WarningIcon") checkbox.warning:ClearAnchors() checkbox.warning:SetAnchor(RIGHT,checkbox.button,LEFT,-5,0) checkbox.warning.tooltipText = warningText end -- Shows the final control ZO_OptionsWindow_InitializeControl(checkbox) return checkbox end What I have garnered so far is that anchor processing errors from one of two things; 1) You actually hit the anchor creation cap 2) Too many child chaining of anchors occurs From point 1) I think I can be fairly safe in saying that it is not the problem. The cap should be fairly high, even running at minimum settings, that so few options should create it. Even without counting, I should only have at most 20 anchors. The cap should be well over 100 if not 1k. Though, I could be wrong. So this leaves me with option 2). I am chaining Panel control -> Header -> containerA -> containerB -> Header 2 -> containerC. So is it that I need to parent everything to the Panel and use offsets for placement because the "Tree" is becoming too deep? Does anyone know how deep in the Tree you can go before this error would happen? What am I missing that this would happen simply by changing from having static code to a re-usable function? I use ClearAnchors() prior to using SetAnchor throughout my entire project, though I likely don't need to in the options section since I should be creating these controls without them having any anchors associated to them previously, but I tend to do it anyway. I have tried it without using ClearAnchors and I still get the error, which is what I would expect to happen. If there's a better way to create an options panel that will prevent this from happening I would love to be pointed in the right direction. Right now I am just flummoxed as to why putting this into a function would even cause it to happen. Is it processing the anchors twice because I'm creating the anchors in the function to a local variable and then the engine is processing them again when I set a new variable to the return? If so, how would you work around this so that you do not have to manually set those 18+ lines of code for every single checkbox you would want to make? Alot of questions, I know. If you've read this far, I really appreciate it and thank you. Thank you ahead of time for anyone that can shed some light on any of this, as well. Last edited by Nogaruk : 05/11/14 at 05:17 AM. |
ESOUI » Developer Discussions » Lua/XML Help » Too many anchors - options menu |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Switch to Linear Mode |
Switch to Hybrid Mode |
Threaded Mode |
|
|