View Single Post
12-10-22, 04:00 PM   #4
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
A simple button on the WorldMapFrame:

Lua Code:
  1. local f = CreateFrame("Button", "AeroMaxxMapButton", WorldMapFrame, "UIPanelButtonTemplate") -- Create a standard Wow style red button (UIPanelButtonTemplate) with the name AeroMaxxMapButton and parent it to the WorldMapFrame
  2. f:SetSize(100, 25) -- Obvious
  3. f:SetFrameStrata("HIGH") -- Set the button high enought in the strata/Level stacks to be seen
  4. f:SetFrameLevel(511)
  5. f:SetPoint("TOPLEFT", 100, 0) -- Position the button's TOPLEFT corner relative to the TOPLEFT of the MapFrame (parent)
  6. f:SetText("Click Me!") -- Give it some text
  7. f:SetScript("OnClick", function(self) -- Tell the button what to do when you click it
  8.     print("You clicked the:", self:GetName())
  9. end)
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote