View Single Post
03/17/20, 04:42 AM   #2
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,578
Welcome to ESOUI!

There are a few different ways how you can access controls. First you have to understand that every named control is automatically assigned to a global variable. For example when the have a structure with names like "MyAddonWindow" -> "$(parent)Container" -> "$(parent)Control" you will end up with three globals "MyAddonWindow", "MyAddonWindowContainer" and "MyAddonWindowContainerControl". That's also a common pitfall for new authors who name their addon's "namespace" table the same as their top-level xml control, not knowing that the control will be assigned to the global variable.

Each control also has an "OnInitialized" callback which passes the object to a Lua function. You can use the function GetControl(parent, "ChildName") to access elements under it, or directly call parent:GetNamedChild("ChildName") which is used underneath. Instead of passing an object you can also just pass the name to GetControl and it will fetch the global variable for you.

From XML you are a bit more limited, but you can use the same expansions used for naming the controls to access them relative to each other. In addition to "$(parent)" there is also "$(grandparent)" and in theory you should be able to create a custom constant with the <string> control and use that too.

For your second questions I suggest you check out this thread. Don't think anyone has made a working autocompletion for VSCode yet, but there are a few projects for other IDEs which could probably be repurposed.

As for libraries, there are not that many. It's probably easiest to sort the category by monthly downloads and read a few of their descriptions every day until you know them all by heart :P
  Reply With Quote