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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 12 ■ Interacting with Widgets 215Figure 12-3: Filter buttons with filtered inventoryYou’dliketobeabletodisplayatooltipwhenthemouseisovertheframe,so you define new OnEnter <strong>and</strong> OnLeave scripts in the template. These scriptsoverwrite the original definitions from BagBuddyItemTemplate, which is veryuseful.You may also have noticed that the Button tag is changed to a CheckButtontag. That gives you access to the GetChecked() method, which enables youto see if the button is currently selected. There is also SetChecked() method,but you won’t need to use it in this addon. The state <strong>of</strong> the button changesautomatically when the user clicks it, so all you need to do is check to see ifit’s actually set in your OnClick h<strong>and</strong>ler.Finally, you set the CheckedTexture <strong>for</strong> the button. This is a special texture<strong>for</strong> check buttons that is shown when the button is selected, <strong>and</strong> is hiddenotherwise. In this case it’s just a highlight around the edge <strong>of</strong> the button thatshould indicate this state.

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

Saved successfully!

Ooh no, something went wrong!