WoW:API Region GetLeft: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 1: Line 1:
Be carefull when using this function, this function returns nil if you use it when:
This function returns the left edge of the frame in relation to the left of the screen. As a frame moves to the right its return value for this function increases, as the frame moves to the left its return value decreases. This function works for all frames including UIParent and WorldFrame.
* you handle the PLAYER_ENTERING_WORLD event
* the frame position has not been saved by WoW to layout-cache.txt.
* frame parent is UIParent


This function is only guaranteed to work after the PLAYER_LOGIN event and then, only if the frame in question is being Shown.  Also, currently if you re-anchor a frame or Show a frame, you will need to wait up to a second before this function will return the correct new value.


This function also may return nil in other situations, I've only tested this case.
Note: The values returned by this function are generally not nice whole numbers but are often close.
Example: 767.99994277954
 
----
;''Arguments''
 
:''none''
 
----
;''Returns''
 
:;number
 
Note: nil is returned if the frame has no anchor points (ie. frame was never positioned or :ClearAllPoints() has been called on the frame)
 
----
;''Example''
local playerFrameLeft = PlayerFrame:GetLeft();
----


==See also==
==See also==

Revision as of 23:22, 8 November 2005

This function returns the left edge of the frame in relation to the left of the screen. As a frame moves to the right its return value for this function increases, as the frame moves to the left its return value decreases. This function works for all frames including UIParent and WorldFrame.

This function is only guaranteed to work after the PLAYER_LOGIN event and then, only if the frame in question is being Shown. Also, currently if you re-anchor a frame or Show a frame, you will need to wait up to a second before this function will return the correct new value.

Note: The values returned by this function are generally not nice whole numbers but are often close. Example: 767.99994277954


Arguments
none

Returns
number

Note: nil is returned if the frame has no anchor points (ie. frame was never positioned or :ClearAllPoints() has been called on the frame)


Example
local playerFrameLeft = PlayerFrame:GetLeft();

See also