Thread Tools Display Modes
10-06-16, 11:20 PM   #1
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
Curious, frame won't hide

The code below is the only code in an addon I started for a test. The texture is a .blp but setting to a non-existant green square makes no difference.

Does anyone have any idea why this one frame is the only UI element that doesn't hide when I Alt-Z? See.

Code:
local button = CreateFrame("Button", "FauxMazzleAssist")
button:SetSize(21, 21)
button:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", -158, 116)
button.Texture = button:CreateTexture("$parentTexture")
button.Texture:SetAllPoints()
button.Texture:SetTexture("Interface/AddOns/FMAssist/MMBG")
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 10-06-16 at 11:42 PM.
  Reply With Quote
10-07-16, 02:53 AM   #2
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 822
Probably not parented to UIParent
__________________
The cataclysm broke the world ... and the pandas could not fix it!
  Reply With Quote
10-07-16, 02:57 AM   #3
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
^ That is the correct answer
CreateFrame("Button", "FauxMazzleAssist", UIParent)
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
  Reply With Quote
10-07-16, 03:11 AM   #4
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
Seriously? Parent being an optional parameter of CreateFrame (unless I've missed something) should automatically revert to UIParent (nil).

If I'm wrong then just what/who is the parent of a nil declared frame?
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 10-07-16 at 03:22 AM.
  Reply With Quote
10-07-16, 03:16 AM   #5
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
No. You need a lot of event handlers. All of those would rest on UIParent too.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
  Reply With Quote
10-07-16, 03:40 AM   #6
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
Alt-Z needs event handlers to hide a frame. My event handlers need to rely on UIParent? I'm getting more confused.

I'm not disrespecting Zork, I'm just not understanding where you're comming from which is probalbly on me.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 10-07-16 at 03:43 AM.
  Reply With Quote
10-07-16, 03:54 AM   #7
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
I have been schooled. Explitily adding UIParent to the CreateFrame function hdes the frame with Alt-Z.

Thank you to Zork and Rilgamon.

My question now is, who is the parent of a frame without that specific declration?
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 10-07-16 at 03:59 AM.
  Reply With Quote
10-07-16, 04:01 AM   #8
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 822
You create it from a template So my guess is WorldFrame ... not at home to test it
__________________
The cataclysm broke the world ... and the pandas could not fix it!
  Reply With Quote
10-07-16, 04:09 AM   #9
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
local button = CreateFrame("Button", "FauxMazzleAssist")

No template involved. Create a "Button" with the name "FauxMazzleAssist".
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
10-07-16, 04:30 AM   #10
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Frames without a parent are mostly used for event handling puposes. They need no parent. And if you call frame:GetParent() it wil probably return nothing.

eventHandler
Lua Code:
  1. local eventHandler = CreateFrame("Frame")
  2. eventHandler.OnEvent = function(...)
  3.   print(...)
  4. end
  5. eventHandler:SetScript("OnEvent",eventHandler.OnEvent)
  6. eventHandler:RegisterEvent("PLAYER_LOGIN")

timer
Lua Code:
  1. --only runs if frame is shown
  2. local timer = CreateFrame("Frame")
  3. timer.OnUpdate = function(...)
  4.   print(...)
  5. end
  6. timer:SetScript("OnUpdate",timer.OnUpdate )
  7. timer:Hide()
  8. --to run the timer you show/hide it OnEvent

If you have a frame that should have an visual impact on the game world it has to be part of UIParent (for the sake of ui scaling alone). Some stuff needs to reside on WorldFrame but that is out of my reach. Semlar could probably tell you more. Of course the parent to UIParent is only needed for the first frame of your stack.

frame stack
Lua Code:
  1. local base = CreateFrame("Frame",nil,UIParent)
  2. local level1 = CreateFrame("Frame",nil,base)
  3. local level2 = CreateFrame("Frame",nil,level1)
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 10-07-16 at 04:40 AM.
  Reply With Quote
10-07-16, 11:41 AM   #11
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
The more I think I know, the more it turns out I don't. I was under the assumtion that UIParent was the default.

Thank you both.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote

WoWInterface » General Discussion » Tech Chat » Curious, frame won't hide

Thread Tools
Display Modes

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