Originally Posted by Blandros
I want it so badly because its the only template fitting the default close button in style.
|
The
UIPanelCloseButton template is the default close (X) button
Code:
<Button name="$parentCloseButton" inherits="UIPanelCloseButton">
that runs this function when clicked:
Lua Code:
-- A bit ugly, we want the talent frame to display a dialog box in certain conditions.
function UIPanelCloseButton_OnClick(self)
local parent = self:GetParent();
if parent then
local continueHide = true;
if parent.onCloseCallback then
continueHide = parent.onCloseCallback(self);
end
if continueHide then
HideUIPanel(parent);
end
end
end
It relies on the frame you want to hide being the direct parent of the button.
It hides the frame but as before, once hidden you can't click the close button with the mouse to show the parent frame again.
If you intend to leave the button on-screen (by parenting it to the "Keyboard" or some frame not parented to "Control") then you could replace it's OnClick script with the one you posted.