12.07.2015 Views

Wiley-World.of.Warcraft.Programming.A.Guide.and.Reference.for.Creating.WoW.Addons

Wiley-World.of.Warcraft.Programming.A.Guide.and.Reference.for.Creating.WoW.Addons

Wiley-World.of.Warcraft.Programming.A.Guide.and.Reference.for.Creating.WoW.Addons

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 12 ■ Interacting with Widgets 233values <strong>for</strong> the bar. Then you can simply set the value <strong>of</strong> the bar to show thecorrect value.Figure 12-19: StatusBars displayed in the skills windowSummaryThis chapter introduced you to two different types <strong>of</strong> interactive widgets thatcan be used in custom addons. You created multiple buttons that showedtooltips when the mouse moved over them, <strong>and</strong> buttons that could be clickedto accomplish some task. In addition, you utilized an edit box to accept inputfrom the user.The CodeBagBuddy.luafunction BagBuddy_OnLoad(self)SetPortraitToTexture(self.portrait, i“Interface\\Icons\\INV_Misc_EngGizmos_30“)-- Create the item slotsself.items = {}<strong>for</strong> idx = 1, 24 dolocal item = CreateFrame(“Button“, “BagBuddy_Item“ .. idx, iself, “BagBuddyItemTemplate“)self.items[idx] = itemif idx == 1 thenitem:SetPoint(“TOPLEFT“, 40, -73)elseif idx == 7 or idx == 13 or idx == 19 thenitem:SetPoint(“TOPLEFT“, self.items[idx-6], “BOTTOMLEFT“, i0, -7)elseitem:SetPoint(“TOPLEFT“, self.items[idx-1], “TOPRIGHT“, i12, 0)endend-- Create the filter buttonsself.filters = {}

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!