View Single Post
11-24-14, 10:37 AM   #5
Zireko
An Aku'mai Servant
Join Date: Nov 2014
Posts: 38
I have tried everything you've suggested also I've flipped things around re-named my frame and it's still not working. My button that I made in the code isn't working with a right click to show and hide the window. Any way here is the code as of right now. Still don't know what I'm doing wrong yet.

Lua Code:
  1. --Want to add Show Hide function for each window. ( barQWindow, barAWindow, barMWindow, barCWindow )
  2. --With the Show Hide I want to add this in an addon options window.
  3. --Want to add a lock frame for each window.
  4. --With lock frame I want to add this in an addon options window.
  5.  
  6. --Create a button using lua that pulls up a window for ZBar Options.
  7.  
  8. -- creates a generic button in the middle of the screen --
  9. ZBarButton = CreateFrame("Button","ZBarButton",UIParent,"UIPanelButtonTemplate")
  10. ZBarButton:SetPoint("CENTER",0,0)
  11. ZBarButton:SetWidth(30)
  12. ZBarButton:SetHeight(30)
  13. ZBarButton:SetText("ZB")
  14. ZBarButton:SetMovable(true)
  15. ZBarButton:RegisterForDrag("LeftButton")
  16. ZBarButton:SetScript("OnDragStart",ZBarButton.StartMoving)
  17. ZBarButton:SetScript("OnDragStop",ZBarButton.StopMovingOrSizing)
  18.  
  19. ZBarOptionFrame = CreateFrame("Frame")
  20. ZBarOptionFrame:ClearAllPoints()
  21. ZBarOptionFrame:SetBackdrop(StaticPopup1:GetBackdrop())
  22. ZBarOptionFrame:SetHeight(300)
  23. ZBarOptionFrame:SetWidth(300)
  24. ZBarOptionFrame:Hide(true)
  25.  
  26. ZBarOptionFrame.text = ZBarOptionFrame:CreateFontString(nil, "BACKGROUND", "GameFontNormal")
  27. ZBarOptionFrame.text:SetAllPoints()
  28. ZBarOptionFrame.text:SetText("ZBar Options Verison 1.0")
  29. ZBarOptionFrame:SetPoint("CENTER", 0, 0)
  30.  
  31. local frame = CreateFrame("Button", nil, UIParent)
  32.  
  33. frame:RegisterForClicks("AnyUp")
  34. frame:SetScript("OnClick", function(self, button, ...)
  35.     if (button == "RightButton") then
  36.         if frame:IsShown() then
  37.             frame:Hide()
  38.         else
  39.             frame:Show()
  40.         end
  41.     end
  42. end)
  Reply With Quote