View Single Post
04-05-09, 12:20 PM   #1
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
secure unit template player button

*edit* Got it working.

This creates a unit button for "player" that can be hovered, left and rightclicked.

Code:
    local orb1 = create_me_a_frame("Button",nil,orbanchorframe,"BACKGROUND",orbsize,orbsize,orbpoint,orbposx,orbposy,orbscale,nil,"SecureUnitButtonTemplate")
    orb1:RegisterForClicks("AnyUp")
    orb1:SetAttribute("unit", "player")
    orb1:SetAttribute("*type1", "target")
    local showmenu = function() 
      ToggleDropDownMenu(1, nil, PlayerFrameDropDown, "cursor", 0, 0) 
    end
    orb1.showmenu = showmenu
    orb1.unit = "player"
    orb1:SetAttribute("*type2", "showmenu")
    orb1:SetScript("OnEnter", UnitFrame_OnEnter)
    orb1:SetScript("OnLeave", UnitFrame_OnLeave)
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 04-05-09 at 01:14 PM.
  Reply With Quote