View Single Post
11-23-14, 08:01 PM   #8
Zireko
An Aku'mai Servant
Join Date: Nov 2014
Posts: 38
I need some help figuring some of this out. I've got my button and a few things in place. I'm trying to teach myself how to more so create a frame in the lua now and trying to understand it a little more. But what I need help on is a few different things.

*I need the button to show and hide my Options frame when it's clicked.
*I need to figure out how to move text up to the top of the frame in the center.
*I need to add some check boxes for each window frame for when there checked they will show my other windows.
*I need to add another check boxes that when it's checked it locks each windows.

The windows I'm trying to hide/show and lock are in my xml.

Here is my code and I'll leave the attachment of the updated addon so far that I'm working on.

LUA Code

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.  
  25. ZBarOptionFrame.text = ZBarOptionFrame:CreateFontString(nil, "BACKGROUND", "GameFontNormal")
  26. ZBarOptionFrame.text:SetAllPoints()
  27. ZBarOptionFrame.text:SetText("ZBar Options Verison 1.0")
  28. ZBarOptionFrame:SetPoint("CENTER", 0, 0)

XML

Lua Code:
  1. <Ui xmlns="http://www.blizzard.com/wow/ui/"
  2.                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3.                    xsi:schemaLocation="http://www.blizzard.com/wow/ui/
  4.                   ..\..\FrameXML\UI.xsd">
  5.     <Frame name="barQWindow" frameStrata="BACKGROUND" parent="UIParent" movable="true" alpha="0.8">
  6.         <Size x="300" y="900"/>
  7.             <Anchors>
  8.                 <Anchor point="BOTTOM"/>
  9.             </Anchors>
  10.             <Layers>
  11.                 <Layer level="BACKGROUND">
  12.                     <Texture file="Interface\AddOns\ZBar\ZBarImgs\barA.blp" setAllPoints="true"/>
  13.                 </Layer>
  14.             </Layers>
  15.     <Scripts>
  16.         <OnMouseDown>
  17.             self:StartMoving()
  18.         </OnMouseDown>
  19.         <OnMouseUp>
  20.             self:StopMovingOrSizing()
  21.         </OnMouseUp>
  22.     </Scripts>
  23.     </Frame>
  24.     <Frame name="barCWindow" frameStrata="BACKGROUND" parent="UIParent" movable="true" alpha="0.8">
  25.         <Size x="600" y="300"/>
  26.             <Anchors>
  27.                 <Anchor point="BOTTOM"/>
  28.             </Anchors>
  29.             <Layers>
  30.                 <Layer level="BACKGROUND">
  31.                     <Texture file="Interface\AddOns\ZBar\ZBarImgs\barA.blp" setAllPoints="true"/>
  32.                 </Layer>
  33.             </Layers>
  34.     <Scripts>
  35.         <OnMouseDown>
  36.             self:StartMoving()
  37.         </OnMouseDown>
  38.         <OnMouseUp>
  39.             self:StopMovingOrSizing()
  40.         </OnMouseUp>
  41.     </Scripts>
  42.     </Frame>
  43.     <Frame name="barMWindow" frameStrata="BACKGROUND" parent="UIParent" movable="true" alpha="0.8">
  44.         <Size x="600" y="300"/>
  45.             <Anchors>
  46.                 <Anchor point="BOTTOM"/>
  47.             </Anchors>
  48.             <Layers>
  49.                 <Layer level="BACKGROUND">
  50.                     <Texture file="Interface\AddOns\ZBar\ZBarImgs\barA.blp" setAllPoints="true"/>
  51.                 </Layer>
  52.             </Layers>
  53.     <Scripts>
  54.         <OnMouseDown>
  55.             self:StartMoving()
  56.         </OnMouseDown>
  57.         <OnMouseUp>
  58.             self:StopMovingOrSizing()
  59.         </OnMouseUp>
  60.     </Scripts>
  61.     </Frame>
  62.     <Frame name="barAWindow" frameStrata="BACKGROUND" parent="UIParent" movable="true" alpha="0.8">
  63.         <Size x="2000" y="300"/>
  64.             <Anchors>
  65.                 <Anchor point="BOTTOM"/>
  66.             </Anchors>
  67.             <Layers>
  68.                 <Layer level="BACKGROUND">
  69.                     <Texture file="Interface\AddOns\ZBar\ZBarImgs\barA.blp" setAllPoints="true"/>
  70.                 </Layer>
  71.             </Layers>
  72.     <Scripts>
  73.         <OnMouseDown>
  74.             self:StartMoving()
  75.         </OnMouseDown>
  76.         <OnMouseUp>
  77.             self:StopMovingOrSizing()
  78.         </OnMouseUp>
  79.     </Scripts>
  80.     </Frame>
  81. </Ui>

TOC

Lua Code:
  1. ## Interface: 60000
  2. ## Title: ZBar
  3. ## Notes: A simple skin addon that allows you to place your ui into it.
  4. ## Author: Zireko
  5. ## Version: 1.0
  6.  
  7. ZBar.xml
  8. ZBar.lua
Attached Files
File Type: zip ZBar.zip (38.6 KB, 157 views)
  Reply With Quote