Thread Tools Display Modes
03-04-13, 02:16 PM   #21
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
There is already an overlay texture.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
03-04-13, 03:15 PM   #22
ravagernl
Proceritate Corporis
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 1,176
...



Well, I guess it's me missing or ignoring screenshots then.
  Reply With Quote
03-04-13, 04:19 PM   #23
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
It's only on the "install" part, not the "activate bonus features" part, but the original code only did anything with the UIParent for the "install" part.

@Mayron:
Try making the following substitions:
UIParent:Hide() -> UIParent:SetAlpha(0)
UIParent:Show() -> UIParent:SetAlpha(1)
That may avoid any taint problems, as well as the unwanted re-showing with the Esc key.

It also occurred to me that your dialogs should hide themselves if the player enters combat, and re-show after combat ends. You can add that by changing this part:

Code:
EventFrame:RegisterEvent("PLAYER_LOGIN")
EventFrame:SetScript("OnEvent", function(self, event, ...)
	self:UnregisterAllEvents()
	self:SetScript("OnEvent", nil)

	if MUI_INSTALLED then
		return
	end

	local setupMode = "setup"

	local AceAddon = LibStub("AceAddon-3.0")
	for _, addon in pairs(ADDONS) do
		addon = AceAddon:GetAddon(addon, true) or _G[addon]
		if type(addon) == "table" and type(addon.db) == "table" and type(addon.db.GetCurrentProfile) == "function" and addon.db:GetCurrentProfile() == "MayronUI" then
			setupMode = "bonus"
			break
		end
	end

	if setupMode == "setup" then
		SetupFrame:Show()
elseif setupMode == "bonus" then
		BonusFrame:Show()
	end
end)
to this:
Code:
EventFrame:RegisterEvent("PLAYER_LOGIN")
EventFrame:SetScript("OnEvent", function(self, event, ...)
	if event == "PLAYER_LOGIN" then
		self:UnregisterEvent("PLAYER_LOGIN")

		if MUI_INSTALLED then
			return self:SetScript("OnEvent", nil)
		end

		local setupMode = "setup"

		local AceAddon = LibStub("AceAddon-3.0")
		for _, addon in pairs(ADDONS) do
			addon = AceAddon:GetAddon(addon, true) or _G[addon]
			if type(addon) == "table" and type(addon.db) == "table" and type(addon.db.GetCurrentProfile) == "function" and addon.db:GetCurrentProfile() == "MayronUI" then
				setupMode = "bonus"
				break
			end
		end

		if setupMode == "setup" then
			SetupFrame:Show()
		elseif setupMode == "bonus" then
			BonusFrame:Show()
		end

		self:RegisterEvent("PLAYER_REGEN_DISABLED")
		self:RegisterEvent("PLAYER_REGEN_ENABLED")

	elseif event == "PLAYER_REGEN_DISABLED" then
		if MayronSetupFrame:IsShown() then
			MayronSetupFrame.__wasShown = true
			MayronSetupFrame:Hide()
		end
		if MayronBonusFrame:IsShown() then
			MayronBonusFrame.__wasShown = true
			MayronBonusFrame:Hide()
		end

	else -- PLAYER_REGEN_ENABLED
		if MayronSetupFrame.__wasShown then
			MayronSetupFrame.__wasShown = nil
			MayronSetupFrame:Show()
		end
		if MayronBonusFrame.__wasShown then
			MayronBonusFrame.__wasShown = nil
			MayronBonusFrame:Show()
		end
	end
end)
And add this to both the DoSetup() and DoBonusSetup() functions, right after the <x>Frame:Hide() line:

Code:
	EventFrame:UnregisterAllEvents()
	EventFrame:SetScript("OnEvent", nil)
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
03-05-13, 01:10 AM   #24
Mayron
A Frostmaul Preserver
 
Mayron's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 275
EDIT: Must have not seen the second page when I last replied. I noticed that UIParent:Hide() was not working so I changed it to UIParent:SetAlpha(0) because I was using that for my old code. Thanks a lot of the advice and the work you put into it. That makes great sense to have to hide while in combat. Really appreciate it!

Last edited by Mayron : 03-06-13 at 01:18 AM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Disable event on click?


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