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 9 ■ Working with Frames, Widgets, <strong>and</strong> Other Graphical Elements 149Table 9-1: Anchoring ExamplesDESCRIPTIONFrameB’s TOPLEFT anchored to FrameA’s TOPRIGHTEXAMPLEFrameB’s TOPLEFT anchored to FrameA’s RIGHTFrameB’s TOPLEFT anchored to FrameA’s BOTTOMRIGHTFrameB’s TOP anchored to FrameA’s BOTTOMFrameB’s RIGHT anchored to FrameA’s LEFT with an x-<strong>of</strong>fset<strong>of</strong> –5 <strong>and</strong> a y-<strong>of</strong>fset <strong>of</strong> –5Using Lua to Create FramesThe equivalent definition in Lua looks like the following:CreateFrame(“Frame“, “BagBuddy“, UIParent)BagBuddy:SetWidth(384)BagBuddy:SetHeight(512)BagBuddy:SetPoint(“CENTER“, UIParent, “CENTER“)The CreateFrame function takes several arguments. The first argument is astring that tells <strong>WoW</strong> what type <strong>of</strong> frame to create. This is the same string asthe XML tag you are using (in this case Frame). If you were creating a statusbar instead <strong>of</strong> a frame, you would specify StatusBar. The second argumentis the name <strong>of</strong> the frame (this is optional, because you can create frames thathave no names). The third argument is the parent frame object, not the name<strong>of</strong> the parent.

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

Saved successfully!

Ooh no, something went wrong!