View Single Post
11-24-14, 08:48 PM   #9
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
Code:
local frame = CreateFrame("Button", nil, UIParent)
 
frame:RegisterForClicks("AnyUp")
frame:SetScript("OnClick", function(self, button, ...)
    if (button == "RightButton") then
        if frame:IsShown() then
            frame:Hide()
        else
            frame:Show()
        end
    end
end)
What you are doing here is creating a button you can't see and telling it to hide/show itself when clicked (well, it will only hide because once hidden it can't be clicked).

What you are looking for is something like:

Code:
local frame = CreateFrame("Button", nil, UIParent)
 -- Add a texture and size so you can see it then anchor it where ever
frame:RegisterForClicks("AnyUp")
frame:SetScript("OnClick", function(self, button, ...)
    if (button == "RightButton") then
        if ZBarOptionFrame:IsVisible() then
            ZBarOptionFrame:Hide()
        else
            ZBarOptionFrame:Show()
        end
    end
end)
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote