In most cases you shouldn't actually add elements in response to an event, but instead create a scenefragment and assign it to a scene.
For example the guild home menu is a scene. The buttons on top (home, roster, history, etc) are one fragment which is added to the guild home scene.
A fragment is basically just a wrapper around a control and can be added to any number of scenes. When a scene shows up, it will automatically make all its fragments visible.
The scene you are looking for is called GUILD_HOME_SCENE. For most cases you can just create a ZO_SimpleSceneFragment.
Lua Code:
local fragment = ZO_SimpleSceneFragment:New(myControl)
GUILD_HOME_SCENE:AddFragment(myControl)
Of course you need to set your anchors as required. If you reuse a fragment on different scenes and want to position it relative to different elements, you can listen to a scene's "StateChange" callback:
Lua Code:
GUILD_HOME_SCENE:RegisterCallback("StateChange", function(oldState, newState)
myControl:ClearAnchors()
if(GUILD_HOME_SCENE:IsShowing()) then
myControl:SetAnchor(...) -- configuration a
else
myControl:SetAnchor(...) -- configuration b
end
end)
Otherwise you could just set them once when you first create the fragment.