Designing GUIs for Addons... how?
[copypasta from my WoW Forums post]
Okay, I've recently picked up addon programming by upgrading an old mod that was discontinued to work with the new 2.4 combat log. It has kinda gotten me hooked, and LUA isn't as difficult as I had previously thought since I already know how to program in VB.NET, so it's just a matter of learning the LUA syntax, WoW API etc. However, one thing that has really kinda stumped me is making GUIs for addons. I have no idea where to start. I'm used to having an IDE such as Visual Studio autogenerate a form and its controls, and I've tried similar tools such as WoWUIDesigner/VB2008 WoW Addon Studio etc. but they've all been discontinued and/or are really buggy. Do you guys (addon authors) write your GUIs in Notepad or something and manually type out all of the XML for frame appearance, control properties, etc.? Because that seems really REALLY tedious, and something I really don't want to deal with... Basically my question is are there any easier ways to design addon GUIs than actually writing out the XML, other than WoWUIDesigner and Addon Studio for WoW, which are both really buggy/outdated? If not, do you have any tips for writing the XML out in Notepad/SciTE-WoW or whatever. It just seems like a huge pain in the ass... reminds me of when I started learning programming with Liberty Basic, aligning controls and designing GUIs using code was terrible. Thanks, I'll be sleeping now so I'll reply tomorrow. :) |
Notepad................
right... Anyway, I don't touch XML, it's a pain in the ass and clutteres up the global namespace because frames have to be named. I generate my frames in lua. As for configs, I personally reccomend you make the base frame only on load, and fill in all the config frames when it's OnShow is called. There's no reason to make all that crap every time the addon loads, just when the user NEEDS it. |
Another problem of XML is that if you have a syntax error in your file, the file won't be loaded, and you'll have no message telling you where to find your error. I'm not sure if some people use decent softwares to parse their files for pure XML errors, but even if you did that, there could still be errors like the misspelling of one of wow's XML keywords, etc...
So, it's really annoying to debug. Afaik, the only thing in XML that you can't do in Lua is creating virtual frames (but I might be wrong on that). So you have to do that another way (there are several options, I believe). |
Can you inherit templates from existing frames when you create others in LUA?
I guess if you are not touching secured frames it is not even a problem. And the just-in-time memory allocation when using LUA-generated frames seems enough of a good reason to do it. |
Quote:
|
WoW, some insights just happened :)
As someone starting to write mods, and a student of software development i have read these few lines with great interest. Thank You. :) |
Quote:
|
Quote:
|
Quote:
|
Quote:
Sad thing is, I find it much easier to make an lua frame factory than an XML template. Less code, don't have to close every tag, easier to read, easier to maintain. Plus with LibStub it's very easy to share the factories among addons without conflicting template names, and you get the nice self-upgrading features... Seriously I can't think of a single pro-temple argument here. |
Quote:
|
Quote:
|
You can still expose them all without littering up the global namespace.
Code:
local f = CreateFrame("Frame", "MyAddonConfig", UIParent) |
Quote:
|
Quote:
|
For editing UI XML specifically, I use Visual Studio. If you point it to the UI.xsd file in FrameXML, then it knows how to autocomplete WoW UI XML. It knows valid values for anchors, which tags fit where, and stuff like that. All that should work in any of the free versions of Visual Studio like the Express editions ( http://msdn.microsoft.com/express ), or the Add-on Studio for World of Warcraft version that's specifically made for WoW mods ( http://codeplex.com/WarcraftAddOnStudio ) Plus, you'll get a listing of all of the errors in your XML, and they'll be highlighted with nice little red squiggles like spelling errors in Word.
|
All times are GMT -6. The time now is 11:09 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI