Thread Tools Display Modes
Prev Previous Post   Next Post Next
07-23-19, 06:17 PM   #1
LudiusMaximus
A Rage Talon Dragon Guard
 
LudiusMaximus's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 322
What EVENT fires when UI elements are ready?

Code:
TimeManagerClockButton:SetScript("OnClick", function (self, button)
  print("Do some stuff.")
  TimeManagerClockButton_OnClick(self)
end)
This in the beginning of my addon does not work, because TimeManagerClockButton is not yet known.

The following works, but is PLAYER_ENTERING_WORLD really the proper event to use?

Code:
local startupFrame = CreateFrame("Frame")
startupFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
startupFrame:SetScript("OnEvent", function(self, event, ...)
  
  TimeManagerClockButton:SetScript("OnClick", function (self, button)
    print("Do some stuff.")
    TimeManagerClockButton_OnClick(self)
  end)
  
end)
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » What EVENT fires when UI elements are ready?


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off