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)