Thread Tools Display Modes
06-30-14, 07:14 AM   #1
atuin_wow
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 11
Question How to permanently hide some frame?

Hello everybody!
Can some one help me with hiding 1 default frame (with its textures) - MonkHarmonyBar?
Im trying to do this with only 1 event -- PLAYER_ENTERING_WORLD
Code:
local maxLight = UnitPowerMax("player", SPELL_POWER_CHI )
local stogChiBar = CreateFrame("Frame","stogChiBarFrame", UIParent)
stogChiBar:SetSize(1, 10)
stogChiBar:SetPoint("CENTER", UIParent, "CENTER", 0, 100)

stogChiBar:RegisterEvent("PLAYER_ENTERING_WORLD")
stogChiBar:SetScript("OnEvent", function(self, event, ...)
 local kids = { MonkHarmonyBar:GetChildren() }
for _, child in ipairs(kids) do
   child:SetParent(stogChiBar)
   child:SetScript("OnEnter", function() return; end)
   child:EnableMouse(false)
end
			
if ( maxLight == 4) then
   MonkHarmonyBarLightEnergy1:SetPoint("LEFT",-43,1)
else
   MonkHarmonyBarLightEnergy1:SetPoint("LEFT",-46,1)
end
MonkHarmonyBar:Hide() --> THAT FRAME I WANT HIDE CONSTANTLY
end )
This code work fine, but SOMETIMES this MonkHarmonyBar frame (with its textures) appear below PlayerFrame. I can fix it with /reload command, but this is not cool =)
Is there any way, how to hide this frame constantly with only 1 event? =)
__________________
Felischaus @ [Lovely Bones] Stormrage - EU
  Reply With Quote
06-30-14, 09:41 AM   #2
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
MonkHarmonyBar:HookScript('OnShow', MonkHarmonyBar.Hide)
  Reply With Quote
06-30-14, 01:13 PM   #3
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Should rather use :UnregisterAllEvents() if you want to stop it, but I guess not in this case as he's using the children.
  Reply With Quote
06-30-14, 11:56 PM   #4
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
None of the monk harmony bar's children have any events registered on them, so I don't really know what you're doing there. You also don't need to wait for any events, since all of the FrameXML code gets loaded and run before any addons are loaded.

Code:
MonkHarmonyBar:UnregisterAllEvents()
MonkHarmonyBar:HookScript("OnShow", MonkHarmonyBar.Hide)
MonkHarmonyBar:Hide()
See also:
http://www.townlong-yak.com/framexml...monyBar.xml#87
http://www.townlong-yak.com/framexml...monyBar.lua#51
__________________
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
07-01-14, 12:31 AM   #5
atuin_wow
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 11
Originally Posted by semlar View Post
MonkHarmonyBar:HookScript('OnShow', MonkHarmonyBar.Hide)
Thank You!
__________________
Felischaus @ [Lovely Bones] Stormrage - EU
  Reply With Quote
07-01-14, 12:32 AM   #6
atuin_wow
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 11
Originally Posted by p3lim View Post
Should rather use :UnregisterAllEvents() if you want to stop it, but I guess not in this case as he's using the children.
Thank You!
__________________
Felischaus @ [Lovely Bones] Stormrage - EU
  Reply With Quote
07-01-14, 12:44 AM   #7
atuin_wow
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 11
Question

Originally Posted by Phanx View Post
None of the monk harmony bar's children have any events registered on them, so I don't really know what you're doing there. You also don't need to wait for any events, since all of the FrameXML code gets loaded and run before any addons are loaded.

Code:
MonkHarmonyBar:UnregisterAllEvents()
MonkHarmonyBar:HookScript("OnShow", MonkHarmonyBar.Hide)
MonkHarmonyBar:Hide()
See also:
http://www.townlong-yak.com/framexml...monyBar.xml#87
http://www.townlong-yak.com/framexml...monyBar.lua#51
Hi and Thx You!
With my tiny addon i just want to move 4-5 "dots" from its parent "MonkHarmonyBar" to "work" in other place on my screen and hide "MonkHarmonyBar" under Player Frame.
Not sure, but if i do "MonkHarmonyBar:Hide()" before i changed its childrens to other frame, they will also be hidden. Am i right?
Im new in LUA and dont know yet short ways =)
__________________
Felischaus @ [Lovely Bones] Stormrage - EU
  Reply With Quote
07-01-14, 02:47 AM   #8
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
If you just want to show the orb icons somewhere else, I'd recommend you do this instead of what you're currently doing (and also instead of what I previously posted):

Lua Code:
  1. -- 1. Detach the chi frame from the default player frame:
  2. MonkHarmonyBar:SetParent(UIParent)
  3.  
  4. -- 2. Move the chi frame somewhere else:
  5. MonkHarmonyBar:ClearAllPoints()
  6. MonkHarmonyBar:SetPoint("BOTTOM", UIParent, "CENTER", 100, 100)
  7.  
  8. -- 3. Hide the background textures on the chi frame:
  9. for i = 1, MonkHarmonyBar:GetNumRegions() do
  10.     select(i, MonkHarmonyBar:GetRegions()):SetTexture("")
  11. end

With this method there's no need to handle any events or do any updates yourself; you can just let the original Blizzard code manage all that.
__________________
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
07-01-14, 03:09 AM   #9
atuin_wow
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 11
Thumbs up

Originally Posted by Phanx View Post
If you just want to show the orb icons somewhere else, I'd recommend you do this instead of what you're currently doing (and also instead of what I previously posted):

Lua Code:
  1. -- 1. Detach the chi frame from the default player frame:
  2. MonkHarmonyBar:SetParent(UIParent)
  3.  
  4. -- 2. Move the chi frame somewhere else:
  5. MonkHarmonyBar:ClearAllPoints()
  6. MonkHarmonyBar:SetPoint("BOTTOM", UIParent, "CENTER", 100, 100)
  7.  
  8. -- 3. Hide the background textures on the chi frame:
  9. for i = 1, MonkHarmonyBar:GetNumRegions() do
  10.     select(i, MonkHarmonyBar:GetRegions()):SetTexture("")
  11. end

With this method there's no need to handle any events or do any updates yourself; you can just let the original Blizzard code manage all that.
Work great, Phanx!
That what i wanned to do, but didnt know, how to work with defaul UI textures (hide/replace).
Love tiny but usefull addons.
__________________
Felischaus @ [Lovely Bones] Stormrage - EU
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » How to permanently hide some frame?


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