View Single Post
05/02/14, 05:49 PM   #1
NickK
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 10
CreateControlFromVirtual -- help

Once again i need help. I'm trying to dynamically create labels and so far nothing i tried worked. I read the part "Is there a way to dynamically create controls like buttons or labels?" on Addon Quick Questions on wiki but i can't figure out what i am doing wrong.

First i copy/pasted the xml from the wiki and i removed the button while changing the name of the label and adding virtual = "true", but i was getting the error "CreateControlFromVirtual Failed". After messing around and trying different things (while still getting the failed message) i decided to copy paste and use what wiki had as is, without changing anything, only to find out that i was getting the same error again.

This is the xml (same as wiki):
Code:
<Button name="DynamicButton" virtual="true" text="Click">
    <Controls>
        <Label name="$(parent)InnerLabel" text="Label" font="ZoFontGame">
            <AnchorFill/>
        </Label>
    </Controls>
</Button>
And this is the lua:
Lua Code:
  1. function OnLoad(eventCode, name)
  2. for i = 1, 10 do
  3.     local dynamicControl = CreateControlFromVirtual("DynamicButton", ZO_FriendsListList, "DynamicButton", i)
  4. end
  5.  
  6. DynamicButton2:SetText("2")
  7.  
  8.  
  9. end

The only difference is that i added a TopLevelControl which is the ZO_FriendsListList.

What am i doing wrong here?

I also checked around in the forum and i found that Wykkyd managed to create a dynamicly dropdown menu using WINDOW_MANAGER only, i tried to do it with WINDOW_MANAGER as well but it didn't work ether.

Thanks for your help.
  Reply With Quote