Thread Tools Display Modes
07-25-12, 01:55 PM   #1
Freebaser
A Molten Kobold Bandit
 
Freebaser's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 135
Don't inherit parent frame alpha

With SetAlpha, all child objects inherit the parent frame alpha. Is there a way around that? I want a specific frame to always have 100% alpha, and still Show/Hide with the parent frame.
  Reply With Quote
07-25-12, 02:07 PM   #2
Haleth
This Space For Rent
 
Haleth's Avatar
Featured
Join Date: Sep 2008
Posts: 1,173
I don't believe that there is; however, you could choose an other parent for your child frame hook the OnShow/OnHide of your original parent frame so that it hides the child frame.
  Reply With Quote
07-25-12, 02:12 PM   #3
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,327
The only way is to not have the child frame parented to the main frame. You'll need to adjust the frame level to what it would be if it were parented to make sure it draws on top. To make it show/hide with the main frame, you'll need to hook the OnShow and OnHide scripts on the main frame to call frame:Show() and frame:Hide() on the "child".

For frames "MainFrame" and "ChildFrame" do:
Code:
ChildFrame:SetFrameLevel(MainFrame:GetFrameLevel()+1);
MainFrame:HookScript("OnShow",function() ChildFrame:Show(); end);
MainFrame:HookScript("OnHide",function() ChildFrame:Hide(); end);
This should mimic the Show/Hide behavior while isolating the alpha. Note, ChildFrame cannot be parented to MainFrame, otherwise the alpha of MainFrame will be applied.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
07-25-12, 02:22 PM   #4
Freebaser
A Molten Kobold Bandit
 
Freebaser's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 135
Alright, thanks.
  Reply With Quote
07-25-12, 04:31 PM   #5
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Another option would be to call :SetAlpha on a texture attached to the main frame instead of calling :SetAlpha on the main frame itself.

If you have multiple elements you want to fade, you could also create an invisible "super parent" and parent both the main frame and the "child" frame to it, and then just call :Hide and :Show on 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

WoWInterface » Developer Discussions » Lua/XML Help » Don't inherit parent frame alpha


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