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:	551
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:	536
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
11-02-10, 05:20 AM   #7
samishii23
An Aku'mai Servant
Join Date: Oct 2010
Posts: 33
Opps. Lol Thanks for that insight.

Code:
<Anchors>
	<Anchor point="BOTTOMLEFT" relativeTo="$parentBottomLeft" relativePoint="BOTTOMRIGHT"/>
	<Anchor point="BOTTOMRIGHT" relativeTo="$parentBottomRight" relativePoint="BOTTOMLEFT"/>
</Anchors>
If theres two anchors in the XML do I have to have two SetPoints() in my LUA code?
  Reply With Quote
11-02-10, 05:52 AM   #8
Ailae
A Rage Talon Dragon Guard
 
Ailae's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2007
Posts: 318
If you want it to look the same, yeah.
__________________
Oh, the simulated horror!
  Reply With Quote
11-02-10, 05:53 AM   #9
samishii23
An Aku'mai Servant
Join Date: Oct 2010
Posts: 33
Holy crap I am so new at this. I put all the points down from the XML. Wow it looks bad. lol. Feel free to laugh with me. Its funny looking.

Code:
	-- Sets a Texture Frame for the window
	-- Top Left
	local BorderTL = SK.Frame.Options:CreateTexture(nil, "BORDER")
	BorderTL:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
	BorderTL:SetWidth(64)
	BorderTL:SetHeight(64)
	BorderTL:SetPoint("TOPLEFT", 0, 0)
	BorderTL:SetTexCoord(.5, .625, 0, 1)
	-- Top Right
	local BorderTR = SK.Frame.Options:CreateTexture(nil, "BORDER")
	BorderTR:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
	BorderTR:SetWidth(64)
	BorderTR:SetHeight(64)
	BorderTR:SetPoint("TOPRIGHT", 0, 0)
	BorderTR:SetTexCoord(.625, .75, 0, 1)
	-- Top
	local BorderT = SK.Frame.Options:CreateTexture(nil, "BORDER")
	BorderT:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
	BorderT:SetWidth(0)
	BorderT:SetHeight(64)
	BorderT:SetPoint("TOPLEFT", 0, 0)
	BorderT:SetPoint("TOPRIGHT", 0, 0)
	BorderT:SetTexCoord(.5, .625, 0, 1)
	-- Bottom Left
	local BorderBL = SK.Frame.Options:CreateTexture(nil, "BORDER")
	BorderBL:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
	BorderBL:SetWidth(64)
	BorderBL:SetHeight(64)
	BorderBL:SetPoint("BOTTOMLEFT", 0, 0)
	BorderBL:SetTexCoord(.75, .87, 0, 1)
	-- Bottom Right
	local BorderBR = SK.Frame.Options:CreateTexture(nil, "BORDER")
	BorderBR:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
	BorderBR:SetWidth(0)
	BorderBR:SetHeight(64)
	BorderBR:SetPoint("BOTTOMRIGHT", 0, 0)
	BorderBR:SetTexCoord(.875, 1, 0 , 1)
	-- Bottom
	local BorderB = SK.Frame.Options:CreateTexture(nil, "BORDER")
	BorderB:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
	BorderB:SetWidth(64)
	BorderB:SetHeight(0)
	BorderB:SetPoint("BOTTOMLEFT", 0, 0)
	BorderB:SetPoint("BOTTOMRIGHT", 0, 0)
	BorderB:SetTexCoord(.376, .5, 0, 1)
	-- Left
	local BorderL = SK.Frame.Options:CreateTexture(nil, "BORDER")
	BorderL:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
	BorderL:SetWidth(0)
	BorderL:SetHeight(64)
	BorderL:SetPoint("BOTTOMLEFT", 0, 0)
	BorderL:SetPoint("TOPLEFT", 0, 0)
	BorderL:SetTexCoord(.002, .125, 0, 1)
	-- Right
	local BorderR = SK.Frame.Options:CreateTexture(nil, "BORDER")
	BorderR:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
	BorderR:SetWidth(0)
	BorderR:SetHeight(64)
	BorderR:SetPoint("BOTTOMRIGHT", 0, 0)
	BorderR:SetPoint("TOPRIGHT", 0, 0)
	BorderR:SetTexCoord(.117, .25, 0, 1)
The result can be seen in attachment. (lol)
Attached Thumbnails
Click image for larger version

Name:	ui_2.JPG
Views:	527
Size:	7.0 KB
ID:	5157  
  Reply With Quote
11-02-10, 06:02 AM   #10
Ailae
A Rage Talon Dragon Guard
 
Ailae's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2007
Posts: 318
If you break the XML-parts that sets points, you'll see that there's three important things. Point, relativeTo and relativePoint. What this means is that you anchor <point> of your frame to frame <relativeTo>s <relativePoint>.

Example
lua Code:
  1. texture:SetPoint(point, relativeTo, relativePoint, 0, 0)

Just substitute the correct values from your original XML.
__________________
Oh, the simulated horror!
  Reply With Quote
11-02-10, 06:03 AM   #11
samishii23
An Aku'mai Servant
Join Date: Oct 2010
Posts: 33
Aw crap. I forgot about the relative to points. Junk. lol
thanks. Hopefully I come back with better news. XD
  Reply With Quote
11-02-10, 06:23 AM   #12
Xubera
A Cobalt Mageweaver
 
Xubera's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 207
Does the <Size x="0" y="64"/> attribute correspond to the Height Width? Or is in the SetPoint()?
Actually, frame's dont really have a size. a frame has 4 points, TOP, LEFT, RIGHT, and BOTTOM

if you say your frame has a size of x=32 and y=32 then say :SetPoint("CENTER") then what it does is set the top y/2 (16 in this case) points from the center of the designated point, sets the left 16 points to the left and so on.

by saying
:SetPoint("TOPLEFT") with the size x=32 and y=32
we are setting the left and top points of the frame to 0, and the bottom and right part to 32 px away.


so lets say

Code:
local frame = CreateFrame("Frame", "myFrame", UIParent)
frame:SetPoint("TOPLEFT")
frame:SetPoint("BOTTOMRIGHT")
you have set all 4 points of the frame to match its parent (UIParent). Since all 4 points are set, the frame is visible

if you did
Code:
local frame = CreateFrame("Frame", "myFrame", UIParent)
frame:SetPoint("TOPLEFT")
by itself, well since you didnt declare a size, it has no way to know where you want a bottom and right point to be, so the frame wont appear

so you can declare any frame with only anchors if you want, just as long as all 4 points are declared. which can be called in 2 commands with TOPLEFT and BOTTOMRIGHT or TOPRIGHT and BOTTOMLEFT

and a frame can be declared with a width and height as long as one point is given. and then wow will figure out the rest

hopefully i didnt confuse :< if i did, sorry
__________________
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-02-10, 06:50 AM   #13
samishii23
An Aku'mai Servant
Join Date: Oct 2010
Posts: 33
Well, it looks better... lol. At first I used SetPoint("TOPRIGHT", BorderTR, 0, 0)
Then I named the textures in CreateTexture(), and used their names, since its whats being done in the XML.

Code:
	-- Sets a Texture Frame for the window
	-- Top Left
	local BorderTL = SK.Frame.Options:CreateTexture("OptBorderTL", "BORDER")
	BorderTL:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
	BorderTL:SetWidth(64)
	BorderTL:SetHeight(64)
	BorderTL:SetPoint("TOPLEFT", 0, 0)
	BorderTL:SetTexCoord(.5, .625, 0, 1)
	-- Top Right
	local BorderTR = SK.Frame.Options:CreateTexture("OptBorderTR", "BORDER")
	BorderTR:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
	BorderTR:SetWidth(64)
	BorderTR:SetHeight(64)
	BorderTR:SetPoint("TOPRIGHT", 0, 0)
	BorderTR:SetTexCoord(.625, .75, 0, 1)
	-- Top
	local BorderT = SK.Frame.Options:CreateTexture("OptBorderT", "BORDER")
	BorderT:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
	BorderT:SetWidth(0)
	BorderT:SetHeight(64)
	BorderT:SetPoint("TOPLEFT", "OptBorderTL", "TOPRIGHT", 0, 0)
	BorderT:SetPoint("TOPRIGHT", "OptBorderTR", "TOPLEFT", 0, 0)
	BorderT:SetTexCoord(.5, .625, 0, 1)
	-- Bottom Left
	local BorderBL = SK.Frame.Options:CreateTexture("OptBorderBL", "BORDER")
	BorderBL:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
	BorderBL:SetWidth(64)
	BorderBL:SetHeight(64)
	BorderBL:SetPoint("BOTTOMLEFT", 0, 0)
	BorderBL:SetTexCoord(.75, .87, 0, 1)
	-- Bottom Right
	local BorderBR = SK.Frame.Options:CreateTexture("OptBorderBR", "BORDER")
	BorderBR:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
	BorderBR:SetWidth(0)
	BorderBR:SetHeight(64)
	BorderBR:SetPoint("BOTTOMRIGHT", 0, 0)
	BorderBR:SetTexCoord(.875, 1, 0, 1)
	-- Bottom
	local BorderB = SK.Frame.Options:CreateTexture("OptBorderB", "BORDER")
	BorderB:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
	BorderB:SetWidth(64)
	BorderB:SetHeight(0)
	BorderB:SetPoint("BOTTOMLEFT", "OptBorderBL", "BOTTOMRIGHT", 0, 0)
	BorderB:SetPoint("BOTTOMRIGHT", "OptBorderBR", "BOTTOMLEFT", 0, 0)
	BorderB:SetTexCoord(.376, .5, 0, 1)
	-- Left
	local BorderL = SK.Frame.Options:CreateTexture("OptBorderL", "BORDER")
	BorderL:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
	BorderL:SetWidth(0)
	BorderL:SetHeight(64)
	BorderL:SetPoint("TOPLEFT", "OptBorderTL", "BOTTOMLEFT", 0, 0)
	BorderL:SetPoint("BOTTOMLEFT", "OptBorderBL", "TOPLEFT", 0, 0)
	BorderL:SetTexCoord(.002, .125, 0, 1)
	-- Right
	local BorderR = SK.Frame.Options:CreateTexture("OptBorderR", "BORDER")
	BorderR:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
	BorderR:SetWidth(0)
	BorderR:SetHeight(64)
	BorderR:SetPoint("BOTTOMRIGHT", "OptBorderBR", "TOPRIGHT", 0, 0)
	BorderR:SetPoint("TOPRIGHT", "OptBorderTR", "BOTTOMRIGHT", 0, 0)
	BorderR:SetTexCoord(.117, .25, 0, 1)
Result in attachment.
Attached Thumbnails
Click image for larger version

Name:	ui_3.JPG
Views:	531
Size:	5.9 KB
ID:	5158  
  Reply With Quote
11-02-10, 07:17 AM   #14
Xubera
A Cobalt Mageweaver
 
Xubera's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 207
try going back through and removing the quotes from your set points on frame references


Code:
BorderT:SetPoint("TOPLEFT", "OptBorderTL", "TOPRIGHT", 0, 0)
	BorderT:SetPoint("TOPRIGHT", "OptBorderTR", "TOPLEFT", 0, 0)
to

Code:
BorderT:SetPoint("TOPLEFT", OptBorderTL, "TOPRIGHT", 0, 0)
	BorderT:SetPoint("TOPRIGHT", OptBorderTR, "TOPLEFT", 0, 0)
__________________
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-02-10, 08:26 AM   #15
samishii23
An Aku'mai Servant
Join Date: Oct 2010
Posts: 33
Bah. I had just placed some Numbers in the SetTexCoord() wrongly. My bad. Anyways.

So now I'm translating this segment...
Code:
<Frame name="$parentTitleButton">
	<Anchors>
		<Anchor point="TOPLEFT" relativeTo="$parentTitleBG"/>
		<Anchor point="BOTTOMRIGHT" relativeTo="$parentTitleBG"/>
	</Anchors>
	<Scripts>
		<OnLoad>self:RegisterForDrag("LeftButton");</OnLoad>
		<OnDragStart>
			local NCMFrame = _G["NCMFrame"];
			NCMFrame.moving = true;
			NCMFrame:StartMoving();
		</OnDragStart>
		<OnDragStop>
			local NCMFrame = _G["NCMFrame"];
			NCMFrame.moving = nil;
			NCMFrame:StopMovingOrSizing();
		</OnDragStop>
	</Scripts>
</Frame>
This is what I have right now, but it ain't working
Code:
	-- Drag Bar Frame
	SK.Frame.Options_Drag = CreateFrame("FRAME", "OptDrag", SK.Frame.Options)
	SK.Frame.Options_Drag:SetPoint("TOPLEFT", "OptBorderTL")
	SK.Frame.Options_Drag:SetPoint("BOTTOMRIGHT", "OptBorderBR")
	SK.Frame.Options_Drag:SetScript("OnEvent", function(obj, event, ...) self:RegisterForDrag("LeftButton") end)
	SK.Frame.Options_Drag:SetScript("OnDragStart", function()
		SK.Frame.Options.moving = true
		SK.Frame.Options:StartMoving()
	end)
	SK.Button.Options_Drag:SetScript("OnDragStop", function()
		SK.Frame.Options.moving = false
		SK.Frame.Options:StopMovingOrSizing()
	end)
  Reply With Quote
11-02-10, 08:38 AM   #16
Ailae
A Rage Talon Dragon Guard
 
Ailae's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2007
Posts: 318
Is this line

lua Code:
  1. SK.Frame.Options_Drag:SetScript("OnEvent", function(obj, event, ...) self:RegisterForDrag("LeftButton") end)

supposed to be equivalent to this line

xml Code:
  1. <OnLoad>self:RegisterForDrag("LeftButton");</OnLoad>

? If so, they are not. :P The one you have in the lua says that when an event fire it should perform :RegisterForDrag. But you never register any event for the frame. Frames created via lua doesn't have a OnLoad-script as far as I know, so you can just do this straight away.

lua Code:
  1. SK.rame.Options_Drag:RegisterForDrag("LeftButton")

You might have to run :EnableMouse(true) as well.
__________________
Oh, the simulated horror!
  Reply With Quote
11-02-10, 09:16 AM   #17
samishii23
An Aku'mai Servant
Join Date: Oct 2010
Posts: 33
Thanks for the help. I had to do :SetMovable() on my frame too, dur.
  Reply With Quote
11-02-10, 10:44 AM   #18
Xubera
A Cobalt Mageweaver
 
Xubera's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 207
Code:
SK.Frame.Options_Drag:SetScript("OnEvent", function(obj, event, ...) self:RegisterForDrag("LeftButton") end)
also you pass the first variable as 'obj' and you call 'self'
__________________
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

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

Thread Tools
Display Modes

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