Thread Tools Display Modes
10-22-14, 12:06 PM   #1
Drool
A Deviate Faerie Dragon
Join Date: Jan 2011
Posts: 10
anchor frame to targetframe/focusframe

hey.

so im editing the default unitframes to my needs, and i just removed all the borders. i then created a new frame with a border texture (ui-dialogbox-border). how can i hook that frame, to the targetframe?

i tryed

Lua Code:
  1. function TargetFrame_Update (target)
  2. if ( not UnitExists(target.unit) ) then
  3.         myframe:Hide();
  4.     else
  5.         myframe:Show();
  6.     end
  7. end

however, said border now shows up and hides whenever i select/deselect a unit. but the targetframe itself is gone too

same goes for petframe, focusframe etc, but i guess i can figure that out once i know how it works

picture related



can someone give me a hint?

Last edited by Drool : 10-22-14 at 12:09 PM.
  Reply With Quote
10-22-14, 12:19 PM   #2
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
I don't completely understand, but you'll probably want to create your own frames as children of the TargetFrame. They will then get shown and hidden along with it without any extra logic.
__________________
Grab your sword and fight the Horde!
  Reply With Quote
10-22-14, 12:57 PM   #3
Drool
A Deviate Faerie Dragon
Join Date: Jan 2011
Posts: 10
wow, its that easy?

Lua Code:
  1. myframe:SetParent(TargetFrame)

already solved my problem! thanks
  Reply With Quote
10-22-14, 02:46 PM   #4
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
Yes. You can also just do it when you create the stuff. If it's a frame you put is as the third argument.
Code:
CreateFrame("Frame", nil, TargetFrame)
Or if it's a texture or a fontstring you use the frame directly:
Code:
TargetFrame:CreateTexture()
__________________
Grab your sword and fight the Horde!
  Reply With Quote
10-22-14, 10:05 PM   #5
Drool
A Deviate Faerie Dragon
Join Date: Jan 2011
Posts: 10
awesome thanks! helped me a lot
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » anchor frame to targetframe/focusframe

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