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 23 ■ <strong>Creating</strong> Dropdown Menus 443Figure 23-9: The ColorPicker frame that appears when the color swatch is selectedUsing Dropdowns <strong>for</strong> SelectionThe examples earlier in this chapter used dropdowns to create popup menus.Although these are used throughout the default user interface, dropdownscan also be used to provide a selection box.Three utility functions are provided to facilitate the graphical setup <strong>of</strong> theframe:UIDropDownMenu_SetWidth(frame, width, padding)frame—The dropdown frame to adjust.width—The desired width <strong>of</strong> the frame.padding—An amount <strong>of</strong> padding on either side <strong>of</strong> the text; defaultsto 25.UIDropDownMenu_SetButtonWidth(frame, width)frame—The dropdown frame to adjust.width—The desired width <strong>of</strong> the button.UIDropDownMenu_JustifyText(frame, justify)frame—The dropdown frame to adjust.justify—The desired justification <strong>of</strong> the text, LEFT, RIGHT, CENTER.Any dropdown that inherits from UIDropDownMenuTemplate is capable <strong>of</strong>being used as a selection dropdown. Run the following Lua script in-game tocreate a new sample menu:if not DropDownMenuTest thenCreateFrame(“Frame“, “DropDownMenuTest“, UIParent,

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

Saved successfully!

Ooh no, something went wrong!