Thread Tools Display Modes
05-27-14, 10:56 AM   #1
Mayron
A Frostmaul Preserver
 
Mayron's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 275
New to XML and cannot show Frame

Hi, I am trying to make many of my frames written in Lua to use XML instead but I am having very strange issues.The first is that if I moved a frame from being a frame on its own to a sub frame of another frame, it disappears. I thought having sub frames were allowed and from reading it appears they are so not sure what is wrong.

Sorry for the bad explanation but I think what would help me out greatly is if I could debug the code. I downloaded SciTE as that was recommended to me and I was told if you press F5 then it validates it but does not do anything for me. F5 is the compiler which is greyed out.

Not sure how else to validate XML.

Here is my code. I have commented on the frame which will not show:

xml Code:
  1. <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/
  2. ..\FrameXML\UI.xsd">
  3.    
  4.     <Frame name="MUI_Bottom" hidden="false" frameStrata="HIGH" parent="UIParent">
  5.         <Size x="751" y="500"/>
  6.         <Anchors>
  7.             <Anchor point="CENTER" relativePoint="CENTER" />
  8.         </Anchors>         
  9.         <Layers>           
  10.             <Layer level="ARTWORK">
  11.                 <Texture name="$parentDataFields" file="Interface\AddOns\MayronUI\Media\DataFields">
  12.                     <Size x="751" y="20"/> 
  13.                     <Anchors>
  14.                         <Anchor point="BOTTOM" relativeTo="$parent" relativePoint="BOTTOM" />
  15.                     </Anchors> 
  16.                 </Texture>
  17.                 <Texture name="$parentActionBars" file="Interface\AddOns\MayronUI\Media\ActionBars">
  18.                     <Size x="751" y="40"/> 
  19.                     <Anchors>
  20.                         <Anchor point="BOTTOM" relativeTo="$parentDataFields" relativePoint="TOP" />
  21.                     </Anchors> 
  22.                 </Texture>
  23.             </Layer>
  24.            
  25.             <Layer level="BACKGROUND">
  26.                 <Texture name="$parentUnitFrames" file="Interface\AddOns\MayronUI\Media\Single">
  27.                     <Size x="752" y="180"/>
  28.                     <Anchors>
  29.                         <Anchor point="BOTTOM" relativeTo="$parent" relativePoint="BOTTOM">
  30.                             <Offset>
  31.                                 <AbsDimension x="0" y="-40" />
  32.                             </Offset>
  33.                         </Anchor>
  34.                     </Anchors> 
  35.                 </Texture>
  36.                 <Texture name="$parentLeftName" file="Interface\AddOns\MayronUI\Media\Names">
  37.                     <Size x="232" y="18"/> 
  38.                     <Anchors>
  39.                         <Anchor point="BOTTOMLEFT" relativeTo="$parentUnitFrames" relativePoint="TOPLEFT">
  40.                             <Offset>
  41.                                 <AbsDimension x="23" y="-1" />
  42.                             </Offset>
  43.                         </Anchor>
  44.                     </Anchors> 
  45.                 </Texture>
  46.                 <Texture name="$parentRightName" file="Interface\AddOns\MayronUI\Media\Names">
  47.                     <Size x="232" y="18"/> 
  48.                     <Anchors>
  49.                         <Anchor point="BOTTOMRIGHT" relativeTo="$parentUnitFrames" relativePoint="TOPRIGHT">
  50.                             <Offset>
  51.                                 <AbsDimension x="-23" y="-1" />
  52.                             </Offset>
  53.                         </Anchor>
  54.                     </Anchors> 
  55.                 </Texture>
  56.             </Layer>
  57.         </Layers>
  58.        
  59.         <!--<Button name="$parentSwitchButton" text="Expand">
  60.             <Size x="434" y="18"/> 
  61.             <Anchors>
  62.                 <Anchor point="BOTTOM" relativeTo="$parentActionBars" relativePoint="TOP" />
  63.             </Anchors> 
  64.             <NormalFont style="GameFontNormal" />
  65.             <Backdrop bgFile="Interface\AddOns\MayronUI\Media\SwitchButton" tile="false"/>     
  66.         </Button>-->
  67.    
  68.     </Frame>
  69.  
  70.         <!-- This is the frame which will NOT show correctly: -->
  71.  
  72.     <Frame name="MUI_Glow" hidden="false"  parent="MUI_BottomActionBars">
  73.         <Size x="488" y="30"/> 
  74.         <Anchors>
  75.             <Anchor point="BOTTOM" relativePoint="TOP" />
  76.         </Anchors> 
  77.         <Backdrop bgFile="Interface\AddOns\MayronUI\Media\Glow" tile="false">
  78.             <BackgroundInsets left="0" right="0" top="0" bottom="0" />
  79.         </Backdrop>
  80.     </Frame>
  81.  
  82. </Ui>

Any advice or help would be great. Thank you for looking at it

The sub frame version of this code which has never worked is below where the <Frames> tag is inside the main frame (MUI_Bottom).

xml Code:
  1. <Frames>
  2.     <Frame name="$parentGlow" parent="$parent">
  3.         <Size x="488" y="30"/> 
  4.         <Anchors>
  5.             <Anchor point="BOTTOM" relativePoint="TOP" />
  6.         </Anchors> 
  7.         <Backdrop bgFile="Interface\AddOns\MayronUI\Media\Glow" tile="false">
  8.             <BackgroundInsets left="0" right="0" top="0" bottom="0" />
  9.         </Backdrop>
  10.     </Frame>
  11. </Frames>

Last edited by Mayron : 05-27-14 at 11:30 AM.
  Reply With Quote
05-27-14, 11:06 AM   #2
Mayron
A Frostmaul Preserver
 
Mayron's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 275
I used http://dev.averageurl.com/wow/xml/

and it says its valid XML but still no luck getting the frame to show again. I did not alter the file structure so the bgFile is valid.

EDIT: I got it to show again as a non sub frame so I guess you cannot have sub frames in a <Frame>?

Last edited by Mayron : 05-27-14 at 11:19 AM.
  Reply With Quote
05-27-14, 11:32 AM   #3
ravagernl
Proceritate Corporis
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 1,176
Can I/we(probably) ask why you want to convert the frames to XM in the first place? The only reason to use XML are either header templates and/or maybe wow ui designer (which is outdated and AFAIK has been superseded now by AddOn Studio 2010).

To get back on topic: have you tried running /print MUI_BottomGlow (which should be the frame name)? Also, to use Scite I think there was a tutorial somewhere on how to get it running with wowlua.

On the topic of editors, I can say that for my work lately I've become quite a fan of PHPStorm which is made by JetBrains. Jetbrains offers a free community version of IntelliJ IDEA, on which all of their products are based. I think there's an World Of Warcraft API Plugin for IntelliJ IDEA somewhere...

EDIT: Found it, funny enough sylvanaar(author of Prat / Wow Instant Messager)is also the author of their official lua plugin

Last edited by ravagernl : 05-27-14 at 11:35 AM.
  Reply With Quote
05-27-14, 11:47 AM   #4
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
Originally Posted by ravagernl View Post
Can I/we(probably) ask why you want to convert the frames to XM in the first place?
This.

Post the actual code with the child frame "embedded" instead of separately. Feel free to use the generic code tag as the highlighting is terrible here. :P

I'm not sure if parent="$parent" works. At the very least it doesn't make sense. The frame knows that its parent is its parent, you specified that by putting it within its parents tags.

Finally, you can find XML errors in Logs\FrameXML.txt.

But once again, are you really sure you want to use XML?
__________________
Grab your sword and fight the Horde!
  Reply With Quote
05-27-14, 02:10 PM   #5
Mayron
A Frostmaul Preserver
 
Mayron's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 275
Originally Posted by Lombra View Post
This.

Post the actual code with the child frame "embedded" instead of separately. Feel free to use the generic code tag as the highlighting is terrible here. :P

I'm not sure if parent="$parent" works. At the very least it doesn't make sense. The frame knows that its parent is its parent, you specified that by putting it within its parents tags.

Finally, you can find XML errors in Logs\FrameXML.txt.

But once again, are you really sure you want to use XML?

Sorry if you already know this but,
If you use "$parent" it grabs the parents name and adds any extra text to the end of the parents name for the new element name so if the parent is MUI_Bottom like in my example and you type "$parentLeft" then the element is created with the name "MUI_BottomLeft" which is a very good way of saving time and making code simpler.
(I miss understood I think)

$parent still works just fine

Makes sense to do that instead. And thanks for the Logs info. I remember hearing about that but forgot so that helped me out a lot!

Last edited by Mayron : 05-27-14 at 02:47 PM.
  Reply With Quote
05-27-14, 02:16 PM   #6
Mayron
A Frostmaul Preserver
 
Mayron's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 275
Originally Posted by ravagernl View Post
EDIT: Found it, funny enough sylvanaar(author of Prat / Wow Instant Messager)is also the author of their official lua plugin
Thank you I will try that out. Not heard of that IDE before. SciTE looks very nice, just wish I could get it to work. I tried some tutorials but no one could answer my question and on forums where people have asked the question of why things are greyed out, no good answer was given so I assumed it was a bug. I have also tried the F.A.Q's. I use used IntelliJ by JetBrains in the past for my Java programming so I know the companies good so sounds promising. Thought that was interesting as well, weird coincidence idd

I wanted to use XML because I like how the inheritance works with virtual frames but then ended up making more normal (non virtual frames) from XML because I found it saved on code and was simpler to use. Think that's just me though. Also I had planned on having the UI have the ability to clone certain frames to create more than one if the user wanted. For example I have nice chat box art for my UI and users wanted to be able to duplicate it to position another chat frame art in a different corner of the screen.

Last edited by Mayron : 05-27-14 at 02:18 PM.
  Reply With Quote
05-27-14, 02:21 PM   #7
Mayron
A Frostmaul Preserver
 
Mayron's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 275
Originally Posted by Lombra View Post
Post the actual code with the child frame "embedded" instead of separately. Feel free to use the generic code tag as the highlighting is terrible here. :P
Just can't understand why the sub frame won't work. Is it not possible? I can't find information on this.
This is the full code so I had a button I created which I commented out as that too did not work. Also my only virtual frame at the top is included but that works just fine.

I personally find the xml highlight much nicer to read but sure.
The entire code with the sub-frame inside the frame is here:

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="MUI_ToolTipTemplate" virtual="true" hidden="true" parent="UIParent">
		<Size x="250" y="200"/>	
		<Anchors> 
			<Anchor point="CENTER" relativePoint="CENTER" />
		</Anchors>		
		<Backdrop bgFile="Interface\AddOns\MayronUI\Media\ToolTip" tile="false" edgeFile="Interface\AddOns\MayronUI\Media\Skinner">
			<EdgeSize val="8"/>
			<BackgroundInsets left="2" right="2" top="2" bottom="2" />
			<Color r="0.5" g="0.5" b="0.5" a="0.8" />
			<BorderColor r="0" g="0" b="0" a="1" />
		</Backdrop>
	</Frame>
	
	<Frame name="MUI_Bottom" hidden="false" frameStrata="HIGH" parent="UIParent">
		<Size x="751" y="500"/>	
		<Anchors> 
			<Anchor point="CENTER" relativePoint="CENTER" />
		</Anchors>			
		<Layers>			
			<Layer level="ARTWORK">
				<Texture name="$parentDataFields" file="Interface\AddOns\MayronUI\Media\DataFields">
					<Size x="751" y="20"/>	
					<Anchors> 
						<Anchor point="BOTTOM" relativeTo="$parent" relativePoint="BOTTOM" />
					</Anchors>	
				</Texture>
				<Texture name="$parentActionBars" file="Interface\AddOns\MayronUI\Media\ActionBars">
					<Size x="751" y="40"/>	
					<Anchors> 
						<Anchor point="BOTTOM" relativeTo="$parentDataFields" relativePoint="TOP" />
					</Anchors>	
				</Texture>
			</Layer>
			
			<Layer level="BACKGROUND">
				<Texture name="$parentUnitFrames" file="Interface\AddOns\MayronUI\Media\Single">
					<Size x="752" y="180"/>	
					<Anchors> 
						<Anchor point="BOTTOM" relativeTo="$parent" relativePoint="BOTTOM">
							<Offset>
								<AbsDimension x="0" y="-40" />
							</Offset>
						</Anchor>
					</Anchors>	
				</Texture>
				<Texture name="$parentLeftName" file="Interface\AddOns\MayronUI\Media\Names">
					<Size x="232" y="18"/>	
					<Anchors> 
						<Anchor point="BOTTOMLEFT" relativeTo="$parentUnitFrames" relativePoint="TOPLEFT">
							<Offset>
								<AbsDimension x="23" y="-1" />
							</Offset>
						</Anchor>
					</Anchors>	
				</Texture>
				<Texture name="$parentRightName" file="Interface\AddOns\MayronUI\Media\Names">
					<Size x="232" y="18"/>	
					<Anchors> 
						<Anchor point="BOTTOMRIGHT" relativeTo="$parentUnitFrames" relativePoint="TOPRIGHT">
							<Offset>
								<AbsDimension x="-23" y="-1" />
							</Offset>
						</Anchor>
					</Anchors>	
				</Texture>
			</Layer>
		</Layers>
		
		<Frame name="$parentGlow" frameStrata="HIGH" frameLevel="20" parent="$parentActionBars">
			<Size x="488" y="30"/>	
			<Anchors> 
				<Anchor point="BOTTOM" relativePoint="TOP" />
			</Anchors>	
			<Backdrop bgFile="Interface\AddOns\MayronUI\Media\Glow" tile="false">
				<BackgroundInsets left="0" right="0" top="0" bottom="0" />
			</Backdrop>
		</Frame>
		
	<!--<Button name="$parentSwitchButton" text="Expand">
			<Size x="434" y="18"/>	
			<Anchors> 
				<Anchor point="BOTTOM" relativeTo="$parentActionBars" relativePoint="TOP" />
			</Anchors>	
			<NormalFont style="GameFontNormal" />
			<Backdrop bgFile="Interface\AddOns\MayronUI\Media\SwitchButton" tile="false"/>		
		</Button>-->

	</Frame>
</Ui>

Last edited by Mayron : 05-27-14 at 02:24 PM.
  Reply With Quote
05-27-14, 02:33 PM   #8
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,877
Lombra was pointing to the use of parent="$parent" in an embeded frame tag. Because the frame is within another Frame tag it is automatically parented. It may be why the embeded version wasn't working.

The only thing you can't do in lua that you need XML for is using the secure framework templates. Create a "factory" function that creates the frames you want on the fly.

Try this.
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="MUI_ToolTipTemplate" virtual="true" hidden="true" parent="UIParent">
		<Size x="250" y="200"/>	
		<Anchors> 
			<Anchor point="CENTER" relativePoint="CENTER" />
		</Anchors>		
		<Backdrop bgFile="Interface\AddOns\MayronUI\Media\ToolTip" tile="false" edgeFile="Interface\AddOns\MayronUI\Media\Skinner">
			<EdgeSize val="8"/>
			<BackgroundInsets left="2" right="2" top="2" bottom="2" />
			<Color r="0.5" g="0.5" b="0.5" a="0.8" />
			<BorderColor r="0" g="0" b="0" a="1" />
		</Backdrop>
	</Frame>
	
	<Frame name="MUI_Bottom" hidden="false" frameStrata="HIGH" parent="UIParent">
		<Size x="751" y="500"/>	
		<Anchors> 
			<Anchor point="CENTER" relativePoint="CENTER" />
		</Anchors>			
		<Layers>			
			<Layer level="ARTWORK">
				<Texture name="$parentDataFields" file="Interface\AddOns\MayronUI\Media\DataFields">
					<Size x="751" y="20"/>	
					<Anchors> 
						<Anchor point="BOTTOM" relativeTo="$parent" relativePoint="BOTTOM" />
					</Anchors>	
				</Texture>
				<Texture name="$parentActionBars" file="Interface\AddOns\MayronUI\Media\ActionBars">
					<Size x="751" y="40"/>	
					<Anchors> 
						<Anchor point="BOTTOM" relativeTo="$parentDataFields" relativePoint="TOP" />
					</Anchors>	
				</Texture>
			</Layer>
			
			<Layer level="BACKGROUND">
				<Texture name="$parentUnitFrames" file="Interface\AddOns\MayronUI\Media\Single">
					<Size x="752" y="180"/>	
					<Anchors> 
						<Anchor point="BOTTOM" relativeTo="$parent" relativePoint="BOTTOM">
							<Offset>
								<AbsDimension x="0" y="-40" />
							</Offset>
						</Anchor>
					</Anchors>	
				</Texture>
				<Texture name="$parentLeftName" file="Interface\AddOns\MayronUI\Media\Names">
					<Size x="232" y="18"/>	
					<Anchors> 
						<Anchor point="BOTTOMLEFT" relativeTo="$parentUnitFrames" relativePoint="TOPLEFT">
							<Offset>
								<AbsDimension x="23" y="-1" />
							</Offset>
						</Anchor>
					</Anchors>	
				</Texture>
				<Texture name="$parentRightName" file="Interface\AddOns\MayronUI\Media\Names">
					<Size x="232" y="18"/>	
					<Anchors> 
						<Anchor point="BOTTOMRIGHT" relativeTo="$parentUnitFrames" relativePoint="TOPRIGHT">
							<Offset>
								<AbsDimension x="-23" y="-1" />
							</Offset>
						</Anchor>
					</Anchors>	
				</Texture>
			</Layer>
		</Layers>
		<Frames>
			<Frame name="$parentGlow" frameStrata="HIGH" frameLevel="20">
				<Size x="488" y="30"/>	
				<Anchors> 
					<Anchor point="BOTTOM" relativePoint="TOP" />
				</Anchors>	
				<Backdrop bgFile="Interface\AddOns\MayronUI\Media\Glow" tile="false">
					<BackgroundInsets left="0" right="0" top="0" bottom="0" />
				</Backdrop>
			</Frame>
		
			<Button name="$parentSwitchButton" text="Expand">
				<Size x="434" y="18"/>	
				<Anchors> 
					<Anchor point="BOTTOM" relativeTo="$parentActionBars" relativePoint="TOP" />
				</Anchors>	
				<NormalFont style="GameFontNormal" />
				<Backdrop bgFile="Interface\AddOns\MayronUI\Media\SwitchButton" tile="false"/>		
			</Button>
		</Frames>

	</Frame>
</Ui>
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 05-27-14 at 02:39 PM.
  Reply With Quote
05-27-14, 02:39 PM   #9
Mayron
A Frostmaul Preserver
 
Mayron's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 275
I read that:

All children of a frame must be placed in the element <Frames> of a frame.
So I added the sub frame that needs to be a child of the main frame inside of an opening and closing <Frames> tag but still no luck.
  Reply With Quote
05-27-14, 02:46 PM   #10
Mayron
A Frostmaul Preserver
 
Mayron's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 275
Thank you so very much Fizzlemizz! That worked! So it was just because I had chosen a different parent for my sub frame, that makes a lot of sense.

Glad I know that for future and will make a note of it. Greatly appreciated!
  Reply With Quote
05-27-14, 02:59 PM   #11
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
Originally Posted by Mayron View Post
Sorry if you already know this but,
If you use "$parent" it grabs the parents name and adds any extra text to the end of the parents name for the new element name so if the parent is MUI_Bottom like in my example and you type "$parentLeft" then the element is created with the name "MUI_BottomLeft" which is a very good way of saving time and making code simpler.
(I miss understood I think)

$parent still works just fine

Makes sense to do that instead. And thanks for the Logs info. I remember hearing about that but forgot so that helped me out a lot!
Yeah, I know, but I meant for the parent attribute, not the name, and I see you've changed it now, but you had put only "$parent" and not added anything to it.

That's the equivalent of doing
Code:
local frame = CreateFrame("Frame", nil, UIParent)
frame:SetParent(UIParent)
or even
Code:
frame:SetParent(frame:GetParent())
The whole point of nesting elements in XML is that they are created as children of their parent element without needing to explicitly specify that.

Originally Posted by Mayron View Post
So I added the sub frame that needs to be a child of the main frame inside of an opening and closing <Frames> tag but still no luck.
Yes, this is true.

Finally, textures or font strings (aka regions) may not have children, only frames may. You put $parentActionBars as the parent which is a texture. It probably has the same effect as not specifying a parent.
__________________
Grab your sword and fight the Horde!

Last edited by Lombra : 05-27-14 at 03:02 PM.
  Reply With Quote
05-27-14, 03:36 PM   #12
Mayron
A Frostmaul Preserver
 
Mayron's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 275
Originally Posted by Lombra View Post
Finally, textures or font strings (aka regions) may not have children, only frames may. You put $parentActionBars as the parent which is a texture. It probably has the same effect as not specifying a parent.
Ah yes I see that now. Thank you, that helped me out a lot and makes a lot of sense, appreciated!
  Reply With Quote
05-30-14, 06:35 PM   #13
JDoubleU00
A Firelord
 
JDoubleU00's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 463
What about using good old reliable Notepad++?
  Reply With Quote
06-01-14, 10:23 AM   #14
Mayron
A Frostmaul Preserver
 
Mayron's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 275
Originally Posted by rocnroll View Post
What about using good old reliable Notepad++?
I always use Notepad++ but it is not an IDE :S
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » New to XML and cannot show Frame


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