View Single Post
07/23/14, 02:00 PM   #5
zgrssd
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 280
I took the basic window from AIResearch Grid:
xml Code:
  1. <GuiXml>
  2.     <Controls>
  3.         <TopLevelControl name="EventExplorerWindow" mouseEnabled="true" movable="true" clampedToScreen="true" hidden="true">
  4.             <Dimensions x="760" y="650" />
  5.             <Anchor point="CENTER" />
  6.             <Controls>
  7.  
  8.                 <Backdrop name="$(parent)BG" inherits="ZO_DefaultBackdrop" />
  9.  
  10.             </Controls>
  11.         </TopLevelControl>
  12.     </Controls>
  13. </GuiXml>

Added merlights template:
xml Code:
  1. <Control name="EventExplorerRow" virtual="true">
  2.     <Dimensions y="45"/>
  3.     <Controls>
  4.         <Label name="$(parent)Id" font="ZoFontGame" horizontalAlignment="RIGHT">
  5.             <Anchor point="RIGHT" relativePoint="LEFT" offsetX="50"/>
  6.         </Label>
  7.         <Label name="$(parent)Name" font="ZoFontGame">
  8.             <Anchor point="LEFT" relativeTo="$(parent)Id" relativePoint="RIGHT" offsetX="20"/>
  9.         </Label>
  10.     </Controls>
  11. </Control>

And made up some basic code to get the table and fill the window with entries:
Lua Code:
  1. local uniqueID = "d893fa70102add4c118054adcc1a1f82"
  2. local LCM = LibStub:GetLibrary("LibConstantMapper")
  3.  
  4. local dataList = {}
  5.  
  6. --get the list of Events
  7. local Events = LCM:getMappedData("Events")
  8.  
  9. local function fillWindow()
  10.     for key, value in ipairs(Events) do
  11.         local row = CreateControlFromVirtual("$(parent)Row", EventExplorerWindow, "EventExplorerRow", key)
  12.     end
  13. end
  14.  
  15. local function windowToggle()
  16.     EventExplorerWindow:SetHidden(not EventExplorerWindow:IsHidden())
  17. end
  18.  
  19. local function OnAddOnLoaded(eventID, AddonName)
  20.     if (AddonName~= "EventExplorer") then return end
  21.    
  22.     fillWindow()
  23.    
  24.     SLASH_COMMANDS["/eventexplo"] = windowToggle
  25. end
  26.  
  27. 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.
  Reply With Quote