Quantcast ESOUI - View Single Post - Check if control exists
View Single Post
10/05/17, 01:33 PM   #3
ObjectMetadata
 
ObjectMetadata's Avatar
Join Date: Oct 2017
Posts: 7
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:
  1. function TestAddon:AddQuestsToGrid()
  2.     local noOfQuests = GetNumJournalQuests()
  3.     local yOffset = 50
  4.     for i = 1, noOfQuests do
  5.         local labelName = "QuestLabel" .. i
  6.         local checkboxName = "QuestCheckBox" .. i
  7.         local label = self:CreateQuestLabel(i, labelName, TestAddonGrid, yOffset)
  8.             --TestAddonGrid is the TopLevelControl in the .xml file
  9.         local checkbox = self:CreateQuestCheckBox(i, checkboxName, TestAddonGrid, label)
  10.         yOffset = yOffset + 50
  11.     end
  12. 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?
  Reply With Quote