View Single Post
01-23-12, 05:02 PM   #4
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Animor View Post
1. Because of tinsert(UISpecialFrames, "AnimorHistoryFrame"), the frame was hidden by default when I reload. However, when I've added AnimorHistoryFrame:Show() to the bottom of the code, it didn't work - nothing happened. But when I used the slash command you coded for me, with the same function, the frame did show. Why is that?
Most likely, at some point during the login process, the game makes sure that all of the frames in UISpecialFrames are hidden. If you want the frame to be visible right away, you will probably need to register for an event like PLAYER_LOGIN, and call frame:Show() then.

Originally Posted by Animor View Post
2. What is the difference between HideParentPanel(self) and self:GetParent():Hide(), and why I should not use the first?
HideParentPanel expects that your frame has an entry in the UIPanelWindows table, and that it has a number of attributes set through frame:SetAttribute(name, value) that tell the game how to position and move your window relative to other open frames. This is the system that arranges the character window and the social window if you open them at the same time, for example.

HideParentPanel will still hide the frame if none of those conditions are met, but it will add unnecessary overhead. It's more efficient to just hide the frame directly, since after all of the extra checks that aren't relevant to your frame, that's all HideParentPanel will do anyway.
  Reply With Quote