Need some help on XML to LUA
I have been working on an older addon from 2017. I have everything working except for one thing. The panel/frame is in XML. I have made a panel with LUA. But its empty. I can pull up the addon with the slash command and all the buttons are there, but no panel around it. In another words I have a blank panel (moveable, exit button) and another with all the addon buttons. Both are on my screen. Can anyone guide me in the right direction?
Code:
<Ui xmlns="http://www.blizzard.com/wow/ui" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> Code:
local Incoming = CreateFrame("Frame", nil, PARENT_FRAME, BackdropTemplateMixin and "BackdropTemplate"); |
It looks like you already have a grasp on how to create UI objects and parent them. If you need a reference, there's WoWPedia's Widget API page.
The most time-consuming part of the conversion is turning XML's tree structure into a flat linear format. |
Quote:
|
Also, try changing the parenting from
Lua Code:
Lua Code:
The name of your XML frame (LocationMessageView) will be added to the global table and, assuming your XML file/frame loads first, you can use that as the parent in your .lua frame. This is done with the names of all frames. |
Quote:
|
You seem to want the XML to be parented to the .lua frame so probably more like:
Lua Code:
and you would show/hide SharpedgeFrame in your slash command I'm assuming the load order of the files based on their order in your OP. |
Quote:
|
The XML is being loaded after the .lua. You don't say if your .lua file is being made part of the addon or a separate addon so I will assume separate and this should work in either case unless the original addon is Load-On-Demand.
Lua Code:
|
Yes its enabled on boot. But now there is nothing on my screen. Even if I use the slash /inc it just gives the options for slash in the chat window.
I really do appreciate you helping me on this. I'm still learning. |
Is /inc showing/hiding SharpedgeFrame or whatever name you gave to the "Incoming" frame?
If the slash command is in the same .lua file as Incoming (but the code is after Incoming has been created) you can use Incoming instead. |
Quote:
|
Can you post all the .lua including the slash command?
Are the .lua and .xml in separate addons or included in the same .toc? |
Quote:
"attempt to index global" when I click a button. But all im getting on my screen is all the clickable buttons for the addon. There is is no exit button. Would you like a link to the addon itself? |
Quote:
The global space where the frame names are stored is shared by all addons and the entire Blizzard UI so a name of "IncomingFrame" being fairly simple, might be being overwittedn by something else. |
Quote:
|
You're essentially taking control of another addon so you can't entirely rely on it's slash command(s). For this you will need to provide one of your own (in this case /sinc)
The .toc for your addon (the ## Dependencies: means the Incomming addon will load first.) Lua Code:
The Sharpedge.lua (or whatever you've called it) Lua Code:
use /sincor whatever you renale "/sinc" to instead of /inc |
Quote:
Code:
Message: [string "Incoming:OnClick"]:1: attempt to index global 'location_message_controller' (a nil value) |
Probably easier just apply a backdrop and close button to the addon frame
Lua Code:
|
Quote:
|
All times are GMT -6. The time now is 12:00 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI