Thread Tools Display Modes
01-02-16, 12:38 PM   #1
BloodyLycan
A Defias Bandit
Join Date: Oct 2010
Posts: 2
Can't get any frames to display

Hello everyone!

Before I start, I should say that I'm an experienced software developer for web applications. I'd like to think that I have a good working knowledge of XML and the LUA language seems simple enough to figure out as I go.

My problem at this point, after pouring through the WoW API and XML tutorials, I can't really get a frame to display. I'm assuming it may be because there's nothing actually in the frame at the moment. I just want to get the frame to display, either on start up or through the ingame "addon screen".

I'm very sure that it's something I'm going wrong . The addon layout at the moment is basic with a single toc file, a main_ui.xml file and a main.lua file all in the same directory.

toc file:
Code:
## Interface: 60200
## Title: My Addon
## Notes: "Nothing to be done."
## Version: Dev

main.lua
ui_main.xml
xml file:
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">
    <!-- the addon's functionality is defined in here -->
    <Frame name="MyAddon_Frame">
     <Size><AbsDimension x="100" y="100"/></Size>
     <Anchors>
      <Anchor point="TOPLEFT"/>
     </Anchors>
    </Frame>
</Ui>
lua file:

Code:
message('HelloWorld')
MyAddon_Frame:Show()
Again, I am very sure that it is something basic maybe I'm not understanding how addons are run within WoW, or maybe it is something wrong with how I'm trying to instantiate the frame. Even a small nudge in the right direction would be very helpful.

Thank you all .
  Reply With Quote
01-02-16, 12:47 PM   #2
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
You haven't told your frame what to look like.

PS.- It's much, much nicer to create your frames in Lua (not an acronym, by the way). You don't need XML unless you're dealing with creating secure templates.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
01-02-16, 01:11 PM   #3
BloodyLycan
A Defias Bandit
Join Date: Oct 2010
Posts: 2
Hmmm... I read a few posts on doing that and it intrigued me. To write a UI within the data layer would be great.

Do you know of any resources that I can look at for me to get started? Most of the addons I've seen still use xml, and I can't find anything on doing that.

Also, I plan on having the addon be primarily within a frame that stays on the screen, sort of like MyRolePlay. I'm not sure whether that would affect how I should go about starting it.

EDit: I did some specific searching for creating lua frames and I came across this tidbit:

local self = CreateFrame("Frame", "FunWidget", UIParent)

Would this be in the right direction for creating a frame in lua?

Last edited by BloodyLycan : 01-02-16 at 01:16 PM.
  Reply With Quote
01-02-16, 01:23 PM   #4
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
In lua your frame would be

Code:
local frame = CreateFrame("Frame", "MyAddon_Frame")
frame:SetSize(100, 100)
frame:ClearAllPoints()
frame:SetPoint("TOPLEFT")
If you want to see it (all "Frames" are transparent by default) add:

Code:
frame.texture = CreateTexture("$parent_Texture")
frame.texture:SetAllPoints(frame)
frame.texture:SetTexture(" ")
Will create a green square which is the default when the texture file can't be found.

If you go here you can find a list of all the widget type (start with "Frame" from the list on the right hand side) and their associated methods.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 01-02-16 at 01:30 PM.
  Reply With Quote
01-02-16, 07:01 PM   #5
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
Originally Posted by Fizzlemizz View Post
Code:
frame.texture = CreateTexture("$parent_Texture")
frame.texture:SetAllPoints(frame)
frame.texture:SetTexture(" ")
CreateTexture(), like CreateFontString(), is a metamethod of frames. As such, you need to call it as Frame:CreateTexture(). Also, you need to specify a draw layer as the second argument. Names are optional and you can pass nil as the first argument to not assign one.



The reason why we need Textures and FontStrings to show frames is because they are the visual elements we see. Frames are just a set of coordinates defining a container that we can align Textures and FontStrings to. Some frame types can also react to mouse events within the screen coordinates they cover.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 01-02-16 at 07:05 PM.
  Reply With Quote
01-02-16, 07:29 PM   #6
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
Originally Posted by SDPhantom View Post
CreateTexture(), like CreateFontString(), is a metamethod of frames. As such, you need to call it as Frame:CreateTexture(). Also, you need to specify a draw layer as the second argument. Names are optional and you can pass nil as the first argument to not assign one.
You are indeed correct, my bad.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Can't get any frames to display

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