Thread Tools Display Modes
07-24-11, 04:30 PM   #1
accidant
A Murloc Raider
Join Date: Nov 2008
Posts: 7
Positionproblems with Frames

Hey all,

I've some prolems with the designing of my UI.
At the moment i'm working at an addon, which does the whole configuration and designing of all Other addons i'm using.

Okee, there Is my Problem. I'm using Shadowed Unit Frames and i tried to create an own Frame which Is Anchored to the Player Unit Frame. I will use this for some nicer background. But i have a Problem with the position. I Know that the framename of my playerframe Is called "SUFUnitplayer" and i Set this As relativeframe, of my own created Frame. But this doesn't work. I cann see the Frame but only at this point , As if i Anchored it to the UIParent.

Does anyone Know A good way how i can get a Connection between These to Frames?? At the moment i use the SetPoint function.

Sorry for my Bad english
  Reply With Quote
07-24-11, 05:30 PM   #2
Waky
A Cobalt Mageweaver
 
Waky's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2010
Posts: 200
I'm not sure if you're setting the anchor beyond just a parent, are you using code that's along these lines?

Code:
local f = CreateFrame("Frame","playerBackground",SUFUnitplayer)
f:SetPoint("CENTER",SUFUnitplayer)
  Reply With Quote
07-24-11, 06:28 PM   #3
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Has the player frame been created yet when you try to attach your frame to it?
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
07-24-11, 11:38 PM   #4
accidant
A Murloc Raider
Join Date: Nov 2008
Posts: 7
Hmm i'm using some more Parameters

Code:
local f = CreateFrame("FRAME", "myFrame", UIParent")
...
f:SetPoint("TOPLEFT", UIParent, "CENTER", SUFUnitplayer, 0, 0)
I already had the Same idea, that the addon isn' t loaded, if i create my Frame. So i uses another Frame which fires the ADDON_LOADED Event and i Check with an Argument the addonname.

But that doesn't work too. Its only shown in the Middle of my screen
  Reply With Quote
07-25-11, 02:42 AM   #5
Ekaterina
A Theradrim Guardian
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 65
If I'm reading your code correctly you're positioning relative to the uiparent.

try:
Code:
local f = CreateFrame("FRAME", "myFrame", UIParent")
...
f:SetPoint("TOPLEFT", SUFUnitplayer, "CENTER", 0, 0)
  Reply With Quote
07-25-11, 03:02 AM   #6
accidant
A Murloc Raider
Join Date: Nov 2008
Posts: 7
Sorry, this was wrongposted by me.

My code is already like Ekaterina posted.
But no changes happens.

Is there anyway to check if the player unitframe is loaded instead of checking if the Addon is loaded. At the moment im try out this way, but it still in the center of my screen

Code:
local actionFrame = CreateFrame("FRAME", "actionFrame", UIParent)
actionFrame:RegisterEvent("ADDON_LOADED")
actionFrame:SetScript("OnEvent", function(self,event,addonName)
   if (adddonName = "ShadowedUnitFrame") then
      local f = CreateFrame("FRAME", "myFrame", UIParent)
      .....some design stuff color and border.....
      f:SetPoint("CENTER", SUFUnitplayer, 0, 0)
      f:Show()
   end
end)
I also tried kgPanels to check if my Anchor is correct. If i create a Panel ingame with this addon and set the anchor, everything works fine. But i don't want to use it. So i also think that the problem is, that the unitframe is not loaded, when i create my Frame. But the way i tried doesn't fix my problems
  Reply With Quote
07-25-11, 08:59 AM   #7
Waky
A Cobalt Mageweaver
 
Waky's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2010
Posts: 200
For an conditionals you need a double equal sign "==", also the addon is "ShadowedUnitFrames" from what I've known

Try this code:

Code:
local actionFrame = CreateFrame("FRAME", "actionFrame", UIParent)
actionFrame:RegisterEvent("ADDON_LOADED")
actionFrame:SetScript("OnEvent", function(self,event,addonName)
   if (adddonName == "ShadowedUnitFrames") then
      local f = CreateFrame("FRAME", "myFrame", UIParent)
      .....some design stuff color and border.....
      f:SetPoint("CENTER", SUFUnitplayer, 0, 0)
      f:Show()
   end
end)
  Reply With Quote
07-25-11, 10:02 AM   #8
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Also, just because an addon has loaded, does not mean that it has finished configuring itself. Perhaps Stuf waits until a later time to finish setting up its frames.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
07-25-11, 10:36 AM   #9
accidant
A Murloc Raider
Join Date: Nov 2008
Posts: 7
hmmm, i tried Waky's way, but nothing changes. The frame is shown, but not at the right point. I confirm to Seerah's way. But is there any possibility to get this information and to tell my frame, that it should setpoint after the Unitframes are created?
  Reply With Quote
07-26-11, 01:09 AM   #10
Ekaterina
A Theradrim Guardian
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 65
Hmm...

Assuming that your code is in your own addon, have you tried setting SUF as a dependancy?

Have you tried parenting the frame to the unit frame?

Code:
local f = CreateFrame("FRAME", "myFrame", SUFUnitplayer)
...
f:SetPoint("TOPLEFT", SUFUnitplayer, "CENTER", 0, 0)

Last edited by Ekaterina : 07-26-11 at 01:11 AM. Reason: For Spelling.
  Reply With Quote
07-26-11, 06:20 AM   #11
accidant
A Murloc Raider
Join Date: Nov 2008
Posts: 7
Yes parenting i've already tried. but didn't got any positive result.

But maybe setting the addon as dependancy will help. Will try this out as soon as i'm home.
  Reply With Quote
07-26-11, 11:13 AM   #12
accidant
A Murloc Raider
Join Date: Nov 2008
Posts: 7
RequiredDeps or OptionalDeps is also not the right way to find a solution.

I tried another Event to check if, the Frame will anchored correctly anytime and that works great. But i don't want that my Frames get set, if i have target.
  Reply With Quote
07-28-11, 04:47 AM   #13
Aftermathhqt
A Molten Giant
 
Aftermathhqt's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 784
This what i use to skin my tinydps.

LUA Code:
  1. local OtherAddOns = CreateFrame("Frame", nil, UIParent)
  2. OtherAddOns:RegisterEvent("ADDON_LOADED")
  3. OtherAddOns:SetScript("OnEvent", function(self, event, AddOn)
  4.     if AddOn == "TinyDPS" then
  5.         InvisFrame = CreateFrame("Frame", nil, tdpsFrame) -- this is a hidden frame to so we can create our border with !Beautycase.
  6.         InvisFrame:SetFrameStrata("MEDIUM") -- what state it should have "HIGH", "LOW", "MEDIUM"
  7.         InvisFrame:SetFrameLevel(2) -- what level the frame should be
  8.         InvisFrame:SetAllPoints()
  9.         CreateBorderLight(InvisFrame, 12, AftermathhUI.bordercolor, AftermathhUI.bordercolor, AftermathhUI.bordercolor, 2) -- create our border to the hidden frame.
  10.         hooksecurefunc("newBar", function(g)
  11.             --statusbar
  12.             dummybar:SetStatusBarTexture(AftermathhUI.media.texture)
  13.             --number fontstring    
  14.             dummybar.fontStringRight:SetFont(AftermathhUI.media.font, 11, AftermathhUI.media.fontflag)
  15.             dummybar.fontStringRight:SetShadowColor(0, 0, 0)
  16.             dummybar.fontStringRight:SetShadowOffset(1, -1)
  17.             --name fontstring
  18.             dummybar.fontStringLeft:SetFont(AftermathhUI.media.font, 11, AftermathhUI.media.fontflag)
  19.             dummybar.fontStringLeft:SetShadowColor(0, 0, 0)
  20.             dummybar.fontStringLeft:SetShadowOffset(1, -1)
  21.         end)   
  22.     end
  23. end)

I hope this helps.
  Reply With Quote
07-28-11, 08:19 AM   #14
Aprikot
A Frostmaul Preserver
 
Aprikot's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2010
Posts: 284
Add quotes to SUFUnitplayer?

Code:
f:SetPoint("CENTER", "SUFUnitplayer", "CENTER", 0, 0)
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Positionproblems with Frames


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