Thread Tools Display Modes
10-30-10, 09:00 PM   #1
samishii23
An Aku'mai Servant
Join Date: Oct 2010
Posts: 33
Help with XML to LUA

I'm trying to reduplicate this nice little title bar I've seen (Attached), but the thing is in XML and I can't figure out how to convert it.

Code:
<Texture name="$parentTitleBG" file="Interface\PaperDollInfoFrame\UI-GearManager-Title-Background">
	<Anchors>
		<Anchor point="TOPLEFT">
			<Offset x="9" y="-6"/>
		</Anchor>
		<Anchor point="BOTTOMRIGHT" relativePoint="TOPRIGHT">
			<Offset x="-6" y="-24"/>
		</Anchor>
	</Anchors>
</Texture>
Not sure how to get this into LUA... Help?
Attached Thumbnails
Click image for larger version

Name:	wow_ss.JPG
Views:	553
Size:	2.4 KB
ID:	5149  
  Reply With Quote
10-30-10, 10:01 PM   #2
Xubera
A Cobalt Mageweaver
 
Xubera's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 207
Code:
<Texture name="$parentTitleBG" file="Interface\PaperDollInfoFrame\UI-GearManager-Title-Background">
	<Anchors>
		<Anchor point="TOPLEFT">
			<Offset x="9" y="-6"/>
		</Anchor>
		<Anchor point="BOTTOMRIGHT" relativePoint="TOPRIGHT">
			<Offset x="-6" y="-24"/>
		</Anchor>
	</Anchors>
</Texture>
to

lua Code:
  1. local myFrame = CreateFrame("Frame", "SomeName")
  2. local tex = myFrame:CreateTexture(myFrame:GetName().."TitleBG")
  3. tex:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Title-Background]])
  4. tex:SetPoint("TOPLEFT", 9, -6)
  5. tex:SetPoint("BOTTOMRIGHT", -6, -24)
  6. myFrame.tex = tex --no needed, but good if you want to reference without the name or local
__________________
Chat Consolidate is the solution to any out of control trade chat. Ignore lines, throttle chat, consolidate posts!Follow the link to find out how!

▲ ▲ WoWInterface wont let me triforce >.>
  Reply With Quote
11-01-10, 01:34 PM   #3
samishii23
An Aku'mai Servant
Join Date: Oct 2010
Posts: 33
Thanks for the conversion. Alas, now its being funky.

Code:
function SK.LoadMain()
	-- Create Main frame
	SK.Frame.Options = CreateFrame("Frame", "SK Test", UIParent)
	SK.Frame.Options:SetFrameStrata("TOOLTIP")
	SK.Frame.Options:SetWidth(200)
	SK.Frame.Options:SetHeight(100)
	SK.Frame.Options:SetPoint("LEFT",100,50)
	SK.Frame.Options:SetBackdrop(SK.Styles.Main)
	SK.Frame.Options:SetBackdropColor(Color("Black"))
	SK.Frame.Options:Hide()
	
	-- X Button to close window
	SK.Button.Options_X = CreateFrame("Button", nil, SK.Frame.Options)
	SK.Button.Options_X:SetPoint("TOPRIGHT", 0, 0)
	SK.Button.Options_X:SetHeight(20)
	SK.Button.Options_X:SetWidth(20)
	SK.Button.Options_X:SetNormalTexture([[Interface\Buttons\UI-Panel-MinimizeButton-Up]]) 
	SK.Button.Options_X:SetPushedTexture([[Interface\Buttons\UI-Panel-MinimizeButton-Down]]) -- OnClick Effect
	SK.Button.Options_X:SetHighlightTexture([[Interface\Buttons\UI-Panel-MinimizeButton-Highlight]], "ADD") -- MouseOver Effect
	SK.Button.Options_X:SetScript("OnClick", function() SK.Frame.Options:Hide() end) -- EventFired action
	
	-- Texture for header bar
	local HeaderBar = SK.Frame.Options:CreateTexture(SK.Frame.Options:GetName().."HeaderBar")
	HeaderBar:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Title-Background]])
	HeaderBar:SetPoint("TOPLEFT", 9, -6)
	HeaderBar:SetPoint("BOTTOMRIGHT", -6, -24)
	SK.Frame.Options.HeaderBar = HeaderBar
	
	-- Title Bar Text
	SK.FString.Str1 = SK.Frame.Options:CreateFontString(nil, "ARTWORK", "GameFontNormal")
	SK.FString.Str1:SetPoint("TOPLEFT", 15, -5)
	SK.FString.Str1:SetText("Testing, Testing!")
	
	-- Event Registering
	SK.Frame.Options:SetScript("OnEvent", SK.Events)
	--SK.Frame.Options:RegisterEvent("
end
Thats the whole frame code. But the texture I just implemented went way over the window code, what did I do wrong? ( Problem seen in attachment )
Attached Thumbnails
Click image for larger version

Name:	ui_1.JPG
Views:	539
Size:	4.9 KB
ID:	5156  
  Reply With Quote
11-01-10, 02:59 PM   #4
Xubera
A Cobalt Mageweaver
 
Xubera's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 207
Code:
local HeaderBar = SK.Frame.Options:CreateTexture(SK.Frame.Options:GetName().."HeaderBar")
	HeaderBar:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Title-Background]])
	HeaderBar:SetPoint("TOPLEFT", 9, -6)
	HeaderBar:SetPoint("BOTTOMRIGHT", -6, -24)--THIS
	SK.Frame.Options.HeaderBar = HeaderBar
You see where you set it at the bottomright, -24 sent the texture towards the bottom of the screen, make the number positive for the texture to move UP
__________________
Chat Consolidate is the solution to any out of control trade chat. Ignore lines, throttle chat, consolidate posts!Follow the link to find out how!

▲ ▲ WoWInterface wont let me triforce >.>
  Reply With Quote
11-01-10, 09:00 PM   #5
samishii23
An Aku'mai Servant
Join Date: Oct 2010
Posts: 33
Question Another...

Thanks for the help with that.
How can I setup a custom border texture? This one is kinda nuts to me. Also really new...
This is what I have to work with...
Code:
<Layer level="BORDER">
	<Texture name="$parentTopLeft" file="Interface\PaperDollInfoFrame\UI-GearManager-Border">
		<Size x="64" y="64"/>
		<Anchors><Anchor point="TOPLEFT"/></Anchors>
		<TexCoords left="0.501953125" right="0.625" top="0" bottom="1"/>
	</Texture>			
	<Texture name="$parentTopRight" file="Interface\PaperDollInfoFrame\UI-GearManager-Border">
		<Size x="64" y="64"/>
		<Anchors><Anchor point="TOPRIGHT"/></Anchors>
		<TexCoords left="0.625" right="0.75" top="0" bottom="1"/>
	</Texture>
	<Texture name="$parentTop" file="Interface\PaperDollInfoFrame\UI-GearManager-Border">
		<Size x="0" y="64"/>
		<Anchors>
			<Anchor point="TOPLEFT" relativeTo="$parentTopLeft" relativePoint="TOPRIGHT"/>
			<Anchor point="TOPRIGHT" relativeTo="$parentTopRight" relativePoint="TOPLEFT"/>
		</Anchors>
		<TexCoords left="0.25" right="0.369140625" top="0" bottom="1"/>
	</Texture>
	<Texture name="$parentBottomLeft" file="Interface\PaperDollInfoFrame\UI-GearManager-Border">
		<Size x="64" y="64"/>
		<Anchors><Anchor point="BOTTOMLEFT"/></Anchors>
		<TexCoords left="0.751953125" right="0.875" top="0" bottom="1"/>
	</Texture>			
	<Texture name="$parentBottomRight" file="Interface\PaperDollInfoFrame\UI-GearManager-Border">
		<Size x="64" y="64"/>
		<Anchors><Anchor point="BOTTOMRIGHT"/></Anchors>
		<TexCoords left="0.875" right="1" top="0" bottom="1"/>
	</Texture>
	<Texture name="$parentBottom" file="Interface\PaperDollInfoFrame\UI-GearManager-Border">
		<Size x="0" y="64"/>
		<Anchors>
			<Anchor point="BOTTOMLEFT" relativeTo="$parentBottomLeft" relativePoint="BOTTOMRIGHT"/>
			<Anchor point="BOTTOMRIGHT" relativeTo="$parentBottomRight" relativePoint="BOTTOMLEFT"/>
		</Anchors>
		<TexCoords left="0.376953125" right="0.498046875" top="0" bottom="1"/>
	</Texture>
	<Texture name="$parentLeft" file="Interface\PaperDollInfoFrame\UI-GearManager-Border">
		<Size x="64" y="0"/>
		<Anchors>
			<Anchor point="TOPLEFT" relativeTo="$parentTopLeft" relativePoint="BOTTOMLEFT"/>
			<Anchor point="BOTTOMLEFT" relativeTo="$parentBottomLeft" relativePoint="TOPLEFT"/>
		</Anchors>
		<TexCoords left="0.001953125" right="0.125" top="0" bottom="1"/>
	</Texture>
	<Texture name="$parentRight" file="Interface\PaperDollInfoFrame\UI-GearManager-Border">
		<Size x="64" y="0"/>
		<Anchors>
			<Anchor point="TOPRIGHT" relativeTo="$parentTopRight" relativePoint="BOTTOMRIGHT"/>
			<Anchor point="BOTTOMRIGHT" relativeTo="$parentBottomRight" relativePoint="TOPRIGHT"/>
		</Anchors>
		<TexCoords left="0.1171875" right="0.2421875" top="0" bottom="1"/>
	</Texture>
</Layer>
This is what I have so far, but I think I'm doin it wrong... Am I on the right track???
Code:
-- Sets a Texture Frame for the window
	-- Top Left
	Local BorderTL = SK.Frame.Options:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
	BorderTL:SetWidth(64)
	BorderTL:SetHeight(64)
	BorderTL:SetPoint("TOPLEFT", 0, 0)
	BorderTL:SetCoords(.5, .625, 0, 1)
	-- Top Right
	Local BorderTR = SK.Frame.Options:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
	BorderTR:SetWidth(64)
	BorderTR:SetHeight(64)
	BorderTR:SetPoint("TOPRIGHT", 0, 0)
	BorderTR:SetCoords(.625, .75, 0, 1)
	-- Top
	Local BorderT = SK.Frame.Options:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
	BorderT:SetWidth(0)
	BorderT:SetHeight(64)
	BorderT:SetPoint("TOPLEFT", 0, 0)
	BorderT:SetCoords(.5, .625, 0, 1)
	-- Bottom Left
	Local BorderT = SK.Frame.Options:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
	BorderT:SetWidth(0)
	BorderT:SetHeight(64)
	BorderT:SetPoint("TOPLEFT", 0, 0)
	BorderT:SetCoords(.5, .625, 0, 1)
Does the <Size x="0" y="64"/> attribute correspond to the Height Width? Or is in the SetPoint()?

Last edited by samishii23 : 11-01-10 at 09:02 PM.
  Reply With Quote
11-01-10, 09:05 PM   #6
Ailae
A Rage Talon Dragon Guard
 
Ailae's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2007
Posts: 318
Looks about right, but you need to create the texture before you apply it.

Example
lua Code:
  1. -- -- can change OVERLAY if you want another to use another framestrata
  2.     Local BorderTL = SK.Frame.Options:CreateTexture(nil, "OVERLAY")
  3.     BorderTL:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
  4.     BorderTL:SetWidth(64)
  5.     BorderTL:SetHeight(64)
  6.     BorderTL:SetPoint("TOPLEFT", 0, 0)
  7.     BorderTL:SetCoords(.5, .625, 0, 1)
__________________
Oh, the simulated horror!
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Help with XML to LUA


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off