Thread Tools Display Modes
06-08-10, 01:04 AM   #1
iindigo
An Aku'mai Servant
 
iindigo's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 32
Taking UIScale into account when calculating width?

Hey guys,

I'm creating a frame in my addon that fills the width of the screen. To do this, of course, I need to set the width of the frame to the width of the current screen resolution.

But there is the nasty little problem of UI scale. How can I take the user's UI scale into account when calculating the width for my frame?
  Reply With Quote
06-08-10, 01:27 AM   #2
Shadowed
...
Premium Member
Featured
Join Date: Feb 2006
Posts: 387
Why not just do frame:SetPoint("LEFT", UIParent, "LEFT", 0, 0); frame:SetPoint("RIGHT", UIParent, "RIGHT", 0, 0) which should work.
  Reply With Quote
06-08-10, 01:51 AM   #3
iindigo
An Aku'mai Servant
 
iindigo's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 32
Originally Posted by Shadowed View Post
Why not just do frame:SetPoint("LEFT", UIParent, "LEFT", 0, 0); frame:SetPoint("RIGHT", UIParent, "RIGHT", 0, 0) which should work.
Well, alright, I left something out of my original post for the the sake of simplification.

What I'm building is made up of three pieces: two endcaps and a middle tiling fill. The endcaps are in place and work fine, but in order to set the middle piece's width appropriately I need the screen width with UI scale factored in.
  Reply With Quote
06-08-10, 02:10 AM   #4
Unkn
Premium Member
 
Unkn's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 258
Originally Posted by iindigo View Post
Well, alright, I left something out of my original post for the the sake of simplification.

What I'm building is made up of three pieces: two endcaps and a middle tiling fill. The endcaps are in place and work fine, but in order to set the middle piece's width appropriately I need the screen width with UI scale factored in.
Anchor the tiling to the endcaps.
__________________
"I'm very feminine. And I'll beat the crap out of ANYONE who disagrees!"
  Reply With Quote
06-08-10, 05:13 AM   #5
Wella
A Rage Talon Dragon Guard
 
Wella's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 322
you could make a frame which goes behind the ends and stretches out 2000 px or so, to cover any resolution. unless it's tiled.
__________________
Addons I use, not that any of you care
* Bejeweled - For boring 5 minute flights to Tanaris
* Genie - Blizzard really should have implemented bag sorting by now
* ncHoverBind - I'm a Lock, what can you expect?
* oGlow - Agan, a missing feature
* Recount - Derp
* ShooShards - Another missing feature


"Your idea is good. So i will try it."
- popmissa
  Reply With Quote
06-08-10, 05:51 AM   #6
nightcracker
A Molten Giant
 
nightcracker's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 716
Originally Posted by Shadowed View Post
Why not just do frame:SetPoint("LEFT", UIParent, "LEFT", 0, 0); frame:SetPoint("RIGHT", UIParent, "RIGHT", 0, 0) which should work.
frame:SetPoint("LEFT", UIParent) frame:SetPoint("RIGHT", UIParent) suffices.
__________________
Three things are certain,
Death, taxes and site not found,
You, victim of one.
  Reply With Quote
06-08-10, 09:54 AM   #7
iindigo
An Aku'mai Servant
 
iindigo's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 32
Originally Posted by Wella View Post
you could make a frame which goes behind the ends and stretches out 2000 px or so, to cover any resolution. unless it's tiled.
Actually, that's part of the reason I need to do this. I'm having to rewrite one of my personal addons because it no longer works with my new display's resolution (2560x1440), as it was designed for 1680x1050. I want to do it in a way that I won't need to rewrite it again; that is, it will function correctly regardless of resolution.

And yes, it's tiled.
  Reply With Quote
06-08-10, 12:13 PM   #8
v6o
An Onyxian Warder
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 399
If you don't anchor your frame to the UIParent you could always just use WorldFrame:GetWidth() but if you really need to get the width with scale then you'll need to wait till VARIABLES_LOADED has fired and then you can check UIParent:GetWidth()
__________________
I stopped playing back World of Warcraft in 2010 and I have no plans on returning.
This is a dead account and if you want to continue any of my addons or make a fork then feel free to do so.
This is your permission slip.

If you need to contact me, do so on Twitter @v6ooo

Best regards, v6.

Last edited by v6o : 06-08-10 at 12:42 PM.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Taking UIScale into account when calculating width?


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