WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   Designing GUIs for Addons... how? (https://www.wowinterface.com/forums/showthread.php?t=15778)

lifetapt 04-07-08 10:06 PM

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. :)

Tekkub 04-07-08 11:28 PM

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.

Layrajha 04-08-08 06:14 AM

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).

Kaomie 04-08-08 08:12 AM

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.

Akryn 04-08-08 08:51 AM

Quote:

Originally Posted by Kaomie (Post 88116)
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.

yep, pass it's name as the 4th argument to CreateFrame

ra1d3n 04-08-08 09:28 AM

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. :)

Seerah 04-08-08 09:43 AM

Quote:

Originally Posted by Tekkub (Post 88093)
Notepad................


right...

Hey - I use Notepad++ :p But xml scares me, so.... :o

Tuller 04-08-08 10:01 AM

Quote:

Originally Posted by Layrajha (Post 88108)
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).

Open the file in firefox.

Tekkub 04-08-08 10:42 AM

Quote:

Originally Posted by Seerah (Post 88130)
Hey - I use Notepad++ :p

Notepad++ is a far cry different from Notepad.

Tekkub 04-08-08 10:48 AM

Quote:

Originally Posted by Kaomie (Post 88116)
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.

As above, it is possible, yes. But if you don't want to litter the global namespace with frame names, it's not really an option. I only use it for the secure templates... and those ones handle anony frames just fine... but the GUI element templates don't.

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.

Seerah 04-08-08 11:44 AM

Quote:

Originally Posted by Tekkub (Post 88137)
Notepad++ is a far cry different from Notepad.

this is true ;) Writing xml with regular old Notepad would be masochistic. :p

Layrajha 04-08-08 06:51 PM

Quote:

Originally Posted by Tekkub (Post 88138)
As above, it is possible, yes. But if you don't want to litter the global namespace with frame names, it's not really an option. I only use it for the secure templates... and those ones handle anony frames just fine... but the GUI element templates don't.

I actually tend to name every "IsMouseEnabled()" frame, for the simple reason that I've often been hacking other people's addons using either stuff like DFM or Moveanything, or personal ad hoc stuff written in some kind of "random mess compilation", and the names of the frames were very helpful there. The global namespace can probably handle that :D

Tekkub 04-08-08 06:55 PM

You can still expose them all without littering up the global namespace.

Code:

local f = CreateFrame("Frame", "MyAddonConfig", UIParent)
f.somecheckbox = CreateFrame(...


Inokis 04-08-08 08:03 PM

Quote:

Originally Posted by Seerah (Post 88145)
this is true ;) Writing xml with regular old Notepad would be masochistic. :p

I use only notepad/wordpad to do everything UI related. I have in Everquest, EQ2, and now in WoW.

Shirik 04-08-08 09:54 PM

Quote:

Originally Posted by Layrajha (Post 88108)
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.

Actually, there is an XML errors log, though it can be difficult to read at times.

VgerAN 04-08-08 11:06 PM

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