Quantcast
Designing GUIs for Addons... how? - WoWInterface
Thread Tools Display Modes
04-07-08, 10:06 PM   #1
lifetapt
A Murloc Raider
 
lifetapt's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 6
Question 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.
  Reply With Quote
04-07-08, 11:28 PM   #2
Tekkub
A Molten Giant
 
Tekkub's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 960
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.
  Reply With Quote
04-08-08, 06:14 AM   #3
Layrajha
A Frostmaul Preserver
 
Layrajha's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 275
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).
  Reply With Quote
04-08-08, 08:12 AM   #4
Kaomie
A Scalebane Royal Guard
 
Kaomie's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2007
Posts: 438
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.
__________________
Kaomie
"WE LOTS OF PEOPLE FROM STRONG SERVER GUILDS" - Trade Channel

Last edited by Kaomie : 04-08-08 at 08:22 AM.
  Reply With Quote
04-08-08, 08:51 AM   #5
Akryn
A Firelord
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 479
Originally Posted by Kaomie View Post
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
  Reply With Quote
04-08-08, 09:28 AM   #6
ra1d3n
A Cyclonian
 
ra1d3n's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2006
Posts: 44
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.
  Reply With Quote
04-08-08, 09:43 AM   #7
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,766
Originally Posted by Tekkub View Post
Notepad................


right...
Hey - I use Notepad++ But xml scares me, so....
__________________
"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
04-08-08, 10:01 AM   #8
Tuller
A Warpwood Thunder Caller
 
Tuller's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 91
Originally Posted by Layrajha View Post
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.
  Reply With Quote
04-08-08, 10:42 AM   #9
Tekkub
A Molten Giant
 
Tekkub's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 960
Originally Posted by Seerah View Post
Hey - I use Notepad++
Notepad++ is a far cry different from Notepad.
  Reply With Quote
04-08-08, 10:48 AM   #10
Tekkub
A Molten Giant
 
Tekkub's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 960
Originally Posted by Kaomie View Post
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.
  Reply With Quote
04-08-08, 11:44 AM   #11
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,766
Originally Posted by Tekkub View Post
Notepad++ is a far cry different from Notepad.
this is true Writing xml with regular old Notepad would be masochistic.
__________________
"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
04-08-08, 06:51 PM   #12
Layrajha
A Frostmaul Preserver
 
Layrajha's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 275
Originally Posted by Tekkub View Post
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
  Reply With Quote
04-08-08, 06:55 PM   #13
Tekkub
A Molten Giant
 
Tekkub's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 960
You can still expose them all without littering up the global namespace.

Code:
local f = CreateFrame("Frame", "MyAddonConfig", UIParent)
f.somecheckbox = CreateFrame(...
  Reply With Quote
04-08-08, 08:03 PM   #14
Inokis
EQInterface Staff
 
Inokis's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 156
Originally Posted by Seerah View Post
this is true Writing xml with regular old Notepad would be masochistic.
I use only notepad/wordpad to do everything UI related. I have in Everquest, EQ2, and now in WoW.
__________________
If not yourself, who can you count on...
  Reply With Quote
04-08-08, 09:54 PM   #15
Shirik
Blasphemer!
Premium Member
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2007
Posts: 818
Originally Posted by Layrajha View Post
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.
__________________
たしかにひとつのじだいがおわるのお
ぼくはこのめでみたよ
だけどつぎがじぶんおばんだってことわ
しりたくなかったんだ
It's my turn next.

Shakespeare liked regexes too!
/(bb|[^b]{2})/
  Reply With Quote
04-08-08, 11:06 PM   #16
VgerAN
A Cyclonian
 
VgerAN's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 40
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.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Designing GUIs for Addons... how?

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