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)