Hi Dolgubon, thanks for your reply!
I checked what you said but the parameter "containingControl" is passed as a hard reference, so it should definitely be the same both times.
This is the function I use to call the "CreateQuestLabel" function:
Lua Code:
function TestAddon:AddQuestsToGrid()
local noOfQuests = GetNumJournalQuests()
local yOffset = 50
for i = 1, noOfQuests do
local labelName = "QuestLabel" .. i
local checkboxName = "QuestCheckBox" .. i
local label = self:CreateQuestLabel(i, labelName, TestAddonGrid, yOffset)
--TestAddonGrid is the TopLevelControl in the .xml file
local checkbox = self:CreateQuestCheckBox(i, checkboxName, TestAddonGrid, label)
yOffset = yOffset + 50
end
end
XML-Code:
Code:
<GuiXml>
<Controls>
<TopLevelControl name="TestAddonGrid" mouseEnabled="true" movable="false" clampedToScreen="true" hidden="true">
<Controls>
<some controls />
</Controls>
</TopLevelControl>
</Controls>
</GuiXml>
The AddQuestsToGrid function gets called by a slash command.
type slash command for the first time -> everything workes as intended since the controls don't yet exist
type slash command for the 2nd time -> Duplicate error
Could this be caused by some weird object instance behaviour? Like that the object "TestAddonGrid" is not the same instance the second time as the first time?