Thanks everyone for replying and helping out. The TopLevelControl was the missing part for it to function.
I do have one more question about the unregister event part once the addon was loaded.
I thought I had to write it like this:
Lua Code:
function addon.OnAddOnLoaded(event, loadedAddonName)
if loadedAddonName == addonName then
addon.InitializeUI()
end
EVENT_MANAGER:UnregisterForEvent(addonName, EVENT_ADD_ON_LOADED)
end
but it’s no longer working if I leave it like this.
If I put it before the
end, it’s working again but not sure if the line even has a functionality on this position.
Lua Code:
function addon.OnAddOnLoaded(event, loadedAddonName)
if loadedAddonName == addonName then
addon.InitializeUI()
EVENT_MANAGER:UnregisterForEvent(addonName, EVENT_ADD_ON_LOADED)
end
end