View Single Post
10-09-23, 10:11 AM   #7
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,892
Originally Posted by Blandros View Post
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:
  1. -- A bit ugly, we want the talent frame to display a dialog box in certain conditions.
  2. function UIPanelCloseButton_OnClick(self)
  3.     local parent = self:GetParent();
  4.     if parent then
  5.         local continueHide = true;
  6.         if parent.onCloseCallback then
  7.             continueHide = parent.onCloseCallback(self);
  8.         end
  9.  
  10.         if continueHide then
  11.             HideUIPanel(parent);
  12.         end
  13.     end
  14. 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.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 10-09-23 at 11:16 AM.
  Reply With Quote