AddOn Studio, WoWPUGBuilder Progress, & XML Woes

I have to start keeping in mind that if I miss one week of updating the blog here, that it's a months worth of real time that passes in between posts. I need to make a better effort of updating the blog at the end of each week rather then every two weeks of work, which is what it seems to be happening lately. So, to catch up on what was missed, I'm going to go over two topics, my quick review of WoW AddOn Studio and the current issue I am facing with my attempts at creating an interface in the AddOn's XML file.
WoW AddOn Studio
So two weeks ago I decided to give working in AddOn Studio a shot. AddOn Studio is a IDE for WoW AddOn development. My hope was that this program would help speed up AddOn development by taking over some of the more mundane tasks such as the building of the interface graphical elements, such that I wouldn't have to delve into XML nitty gritty details and instead I could focus more on the functionality of the AddOn programming in Lua.
Unfortunately, I did not have an easy time with AddOn Studio, but since it's currently in beta, don't put too much weight on my current experience with it. To start, it seemed that the application, written to give the programmer a Visual Studio style environment to work in. While the design of the application is clean and lends itself to standard Windows design aesthetics, there were some minor glitches that took some adaptation to work with, like entered values resetting to a previous value despite being changed, or difficulties with the drag and drop system of building the user interface for the AddOn. Ultimately, what made unwilling to use AddOn Studio as a full time production tool was the limited set of "widgets" available within the Toolbox section. I'm going to have to admit, however, that I didn't spend too much time trying to get things to work right off the bat, so please don't take this as a definitive review of AddOn Studio. I'm pretty sure my own ignorance is to blame for some of my difficulties with the program. It's a great idea, however, and I'm not against going back to trying it again when I have more time to fiddle with it.
WoWPUGBuilder Progress
Okay, so it's been a little slow going but I've managed to get two items of functionality to work, in a basic sense. I've created the UI with a close button in the upper right hand corner and I have added slash commands /wowpugbuilder show and /wowpugbuilder hide which will show and hide the AddOn window respectively. I've started working on adding the "widgets" to the window but have hit an impasse where the code given to produce, in this instance a drop down menu, hasn't actually worked to produce any visible effect.
** Close Button **
To create the close button, I looked at another AddOn, Blizzard_TimeManager, to get the code I was looking for that would make this button work. It was relatively simple and only took a few lines of code in the .xml and .lua files. To start, I added the following to the .xml file...
<Frames>
<Button name="WoWPBCloseButton" inherits="UIPanelCloseButton">
<Anchors>
<Anchor point="TOPRIGHT">
<Offset x="-46" y="-8"/>
</Anchor>
</Anchors>
<Scripts>
<OnClick function="WoWPBCloseButton_OnClick"/>
</Scripts>
</Button>
</Frames>
... this basically creates a frame button that is displayed as the standard red and yellow "x" button in the upper right hand corner of the frame, with a script that calls the function WoWPBCloseButton_OnClick. That function was then created in the .lua files as follows...
function WoWPBCloseButton_OnClick()
WoWPUGBuilderFrame:Hide();
end
...so easy a caveman could do it. ;) So now, when you click on the close button it will hide the frame from the players screen.
** Slash Commands **
Now with an easy method of hiding the AddOn window, I needed a means to get it back up there. That's where creating a slash command comes in. Again this was a pretty easy task that is describe in Chapter 18 of World of Warcraft Programming. All the code necessary for creating a slash command is contained within the .lua file and is (obviously) written as a function and a one line global variable.
The first thing to do is to create the global variable that defines the slash command. In this case it was...
SLASH_WOWPUGBUILDER1 = '/wowpugbuilder';
... the syntax for the variable must follow the format...
SLASH_[VARIABLE][NUMBER]
... additional slash commands can follow the same convention by changing the number component.
Next I had to create the function that would process the command...
function SlashCmdList.WOWPUGBUILDER(msg, editbox)
if msg == 'show' then
print('your command was show');
WoWPUGBuilderFrame:Show();
elseif msg == 'hide' then
print('your command was hide');
WoWPUGBuilderFrame:Hide();
else
print('You did not type a command. Use "show" to show the window or "hide" to hide it.');
end
end
... this function will take the command passed to it, either show or hide the window, and print a message to the chat windows. If the user did not supply a command, then a short message will print out explaining that they didn't include a command and what the expected commands should be.
** Drop Down Menu **
After coding the close button and slash commands, I tried to move on to creating the widgets that the user will use to set the AddOn to do it's tasks. This is where I got stumped. My goal was to create a drop down menu in which the user could select the dungeon they wish to advertise for. My research on drop down menus brought me to the Using UIDropDownMenu article at WoWWiki. From looking at the article, it seemed easy enough, so a set about adding the suggested code to my files.
I began with the XML...
<Frames>
<Button name="MyDropDownMenuButton">
<Scripts>
<OnLoad>
UIDropDownMenu_Initialize(this, MyDropDownMenu_OnLoad)
print("UIDropDownMenu_Initialize")
</OnLoad>
<OnClick>
MyDropDownMenuButton_OnClick()
print("OnClick")
</OnClick>
</Scripts>
</Button>
</Frames>
... this builds a frame button with scripts to run the initialization and OnClick functions...
function MyDropDownMenu_OnLoad()
info = {};
info.text = "This is an option in the menu.";
info.value = "OptionVariable";
info.func = FunctionCalledWhenOptionIsClicked
UIDropDownMenu_AddButton(info);
print("MyDropDownMenu_OnLoad");
end
function MyDropDownMenuButton_OnClick()
ToggleDropDownMenu(1, nil, MyDropDownMenu, MyDropDownMenuButton, 0, 0);
end
...Unfortunately, none of this code has actually generated a drop down menu. One thing that I've noticed lacking in the above XML are <Anchor> tags. How does the AddOn know where to put the drop down menu, as well as a lacks of texture information for how this drop down menu should look. What's more confusing is that when I look in another AddOn that uses a drop down menu, such as the previously mentioned Blizzard_TimeManager, the code that appears there is pretty much the same as what has been described at WoWWiki. All I can conclude is that I'm missing some piece of the puzzle. I've created a topic, called Drop Down Menus at the WoW Programming development forums.
So that is where I am currently at with this project. It doesn't seem like much for the amount of time I have been working on it, but it is a learning process for me. Hopefully I can get this current roadblock cleared up and start to really dig into creating this AddOn.
Comments