I took the basic window from AIResearch Grid:
xml Code:
<GuiXml>
<Controls>
<TopLevelControl name="EventExplorerWindow" mouseEnabled="true" movable="true" clampedToScreen="true" hidden="true">
<Dimensions x="760" y="650" />
<Anchor point="CENTER" />
<Controls>
<Backdrop name="$(parent)BG" inherits="ZO_DefaultBackdrop" />
</Controls>
</TopLevelControl>
</Controls>
</GuiXml>
Added merlights template:
xml Code:
<Control name="EventExplorerRow" virtual="true">
<Dimensions y="45"/>
<Controls>
<Label name="$(parent)Id" font="ZoFontGame" horizontalAlignment="RIGHT">
<Anchor point="RIGHT" relativePoint="LEFT" offsetX="50"/>
</Label>
<Label name="$(parent)Name" font="ZoFontGame">
<Anchor point="LEFT" relativeTo="$(parent)Id" relativePoint="RIGHT" offsetX="20"/>
</Label>
</Controls>
</Control>
And made up some basic code to get the table and fill the window with entries:
Lua Code:
local uniqueID = "d893fa70102add4c118054adcc1a1f82"
local LCM = LibStub:GetLibrary("LibConstantMapper")
local dataList = {}
--get the list of Events
local Events = LCM:getMappedData("Events")
local function fillWindow()
for key, value in ipairs(Events) do
local row = CreateControlFromVirtual("$(parent)Row", EventExplorerWindow, "EventExplorerRow", key)
end
end
local function windowToggle()
EventExplorerWindow:SetHidden(not EventExplorerWindow:IsHidden())
end
local function OnAddOnLoaded(eventID, AddonName)
if (AddonName~= "EventExplorer") then return end
fillWindow()
SLASH_COMMANDS["/eventexplo"] = windowToggle
end
EVENT_MANAGER:RegisterForEvent("MyAddOn", EVENT_ADD_ON_LOADED, OnAddOnLoaded)
I only added the OnLoadedEvent because I got the errors from below and asumed the code was a bit to "early". But that was not it.
And all I get are those error messages and an empty window:
Code:
CreateControlFromVirtual failed. ControlName[EventExplorerDynamicRow1], ParentName[EventExplorerWindow], VirtualName[EventExplorerRow].
CreateControlFromVirtual failed. ControlName[EventExplorerDynamicRow2], ParentName[EventExplorerWindow], VirtualName[EventExplorerRow].
CreateControlFromVirtual failed. ControlName[EventExplorerDynamicRow3], ParentName[EventExplorerWindow], VirtualName[EventExplorerRow].
And there is no explanation what exactly went wrong. Or even what remotely went wrong.