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:
--Want to add Show Hide function for each window. ( barQWindow, barAWindow, barMWindow, barCWindow )
--With the Show Hide I want to add this in an addon options window.
--Want to add a lock frame for each window.
--With lock frame I want to add this in an addon options window.
--Create a button using lua that pulls up a window for ZBar Options.
-- creates a generic button in the middle of the screen --
ZBarButton = CreateFrame("Button","ZBarButton",UIParent,"UIPanelButtonTemplate")
ZBarButton:SetPoint("CENTER",0,0)
ZBarButton:SetWidth(30)
ZBarButton:SetHeight(30)
ZBarButton:SetText("ZB")
ZBarButton:SetMovable(true)
ZBarButton:RegisterForDrag("LeftButton")
ZBarButton:SetScript("OnDragStart",ZBarButton.StartMoving)
ZBarButton:SetScript("OnDragStop",ZBarButton.StopMovingOrSizing)
ZBarOptionFrame = CreateFrame("Frame")
ZBarOptionFrame:ClearAllPoints()
ZBarOptionFrame:SetBackdrop(StaticPopup1:GetBackdrop())
ZBarOptionFrame:SetHeight(300)
ZBarOptionFrame:SetWidth(300)
ZBarOptionFrame.text = ZBarOptionFrame:CreateFontString(nil, "BACKGROUND", "GameFontNormal")
ZBarOptionFrame.text:SetAllPoints()
ZBarOptionFrame.text:SetText("ZBar Options Verison 1.0")
ZBarOptionFrame:SetPoint("CENTER", 0, 0)
XML
Lua Code:
<Ui xmlns="http://www.blizzard.com/wow/ui/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\..\FrameXML\UI.xsd">
<Frame name="barQWindow" frameStrata="BACKGROUND" parent="UIParent" movable="true" alpha="0.8">
<Size x="300" y="900"/>
<Anchors>
<Anchor point="BOTTOM"/>
</Anchors>
<Layers>
<Layer level="BACKGROUND">
<Texture file="Interface\AddOns\ZBar\ZBarImgs\barA.blp" setAllPoints="true"/>
</Layer>
</Layers>
<Scripts>
<OnMouseDown>
self:StartMoving()
</OnMouseDown>
<OnMouseUp>
self:StopMovingOrSizing()
</OnMouseUp>
</Scripts>
</Frame>
<Frame name="barCWindow" frameStrata="BACKGROUND" parent="UIParent" movable="true" alpha="0.8">
<Size x="600" y="300"/>
<Anchors>
<Anchor point="BOTTOM"/>
</Anchors>
<Layers>
<Layer level="BACKGROUND">
<Texture file="Interface\AddOns\ZBar\ZBarImgs\barA.blp" setAllPoints="true"/>
</Layer>
</Layers>
<Scripts>
<OnMouseDown>
self:StartMoving()
</OnMouseDown>
<OnMouseUp>
self:StopMovingOrSizing()
</OnMouseUp>
</Scripts>
</Frame>
<Frame name="barMWindow" frameStrata="BACKGROUND" parent="UIParent" movable="true" alpha="0.8">
<Size x="600" y="300"/>
<Anchors>
<Anchor point="BOTTOM"/>
</Anchors>
<Layers>
<Layer level="BACKGROUND">
<Texture file="Interface\AddOns\ZBar\ZBarImgs\barA.blp" setAllPoints="true"/>
</Layer>
</Layers>
<Scripts>
<OnMouseDown>
self:StartMoving()
</OnMouseDown>
<OnMouseUp>
self:StopMovingOrSizing()
</OnMouseUp>
</Scripts>
</Frame>
<Frame name="barAWindow" frameStrata="BACKGROUND" parent="UIParent" movable="true" alpha="0.8">
<Size x="2000" y="300"/>
<Anchors>
<Anchor point="BOTTOM"/>
</Anchors>
<Layers>
<Layer level="BACKGROUND">
<Texture file="Interface\AddOns\ZBar\ZBarImgs\barA.blp" setAllPoints="true"/>
</Layer>
</Layers>
<Scripts>
<OnMouseDown>
self:StartMoving()
</OnMouseDown>
<OnMouseUp>
self:StopMovingOrSizing()
</OnMouseUp>
</Scripts>
</Frame>
</Ui>
TOC
Lua Code:
## Interface: 60000
## Title: ZBar
## Notes: A simple skin addon that allows you to place your ui into it.
## Author: Zireko
## Version: 1.0
ZBar.xml
ZBar.lua