Thread Tools Display Modes
10-08-10, 11:37 PM   #1
sirann
A Flamescale Wyrmkin
Join Date: Mar 2007
Posts: 142
Coding Unit Frames help.

So I basically am the equivalent of a parrot when it comes to scripting, I can mimic what I see, but really have no idea how to actually create code.

I wrote this:
http://lua.pastebin.com/NVyb5zpv

It's currently only the player frame of a hopefully very, very lightweight and efficient set of frames.

Currently everything's working as I want it to, with the exception of getting tooltips on mouseover, as well as the ability to interact with the frame, ie, click it to target myself, or right click it to pull up the player frame (reset isntances, set dungeon difficulty etc)

I'm sure the code is inefficient, it seems like it's overly complicated at parts, so any advice on code clean up as well as the two requests I had would be fantastic.


Thanks in advance.
  Reply With Quote
10-13-10, 05:12 AM   #2
henrik_s
Enhancement Shaman
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 19
This will do what you want:

Code:
SecureUnitButton_OnLoad(MyPlayerFrame, "player", function()
 ToggleDropDownMenu(1, nil, PlayerFrameDropDown, "cursor")
end)
For the tooltip to show, you will also need something like

Code:
MyPlayerFrame:SetScript("OnEnter", function()
 GameTooltip:SetUnit("player")
end)
Hope that helps!

edit: You need to create a secure frame for this to work.
Code:
local MyPlayerFrame = CreateFrame("Button", nil, UIParent, "SecureUnitButtonTemplate")

Last edited by henrik_s : 10-13-10 at 05:20 AM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Coding Unit Frames help.

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off