Account Options

  1. Sign in
Google Groups Home
« Groups Home
getBoxObjectFor deprecated
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
arenev...@fdn.fr  
View profile  
 More options Mar 4 2008, 1:46 pm
Newsgroups: mozilla.dev.tech.xul
From: arenev...@fdn.fr
Date: Tue, 04 Mar 2008 12:46:29 -0600
Local: Tues, Mar 4 2008 1:46 pm
Subject: getBoxObjectFor deprecated
Hi,
I need, from firefox chrome, to get screen position of an element in a web
page (to show a popup to a position dependent of that element).  Therefore, I
use:

var doc = element.ownerDocument;
var x = element.getBoundingClientRect().right
        + doc.getBoxObjectFor(doc.documentElement).screenX
        + doc.documentElement.scrollLeft;

and I get right border position.

but firefox3 outputs in console:

> Warning: Use of getBoxObjectFor() is deprecated. Try to use
> element.getBoundingClientRect() if possible.

Problem is getBoundingClientRect will not get screenX. Should I still use
getBoxObjectFor even if deprecated for html elements, or is there anothery way
to get screen position of an element ?

thanks


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Neil  
View profile  
 More options Mar 5 2008, 6:42 am
Newsgroups: mozilla.dev.tech.xul
From: Neil <n...@parkwaycc.co.uk>
Date: Wed, 05 Mar 2008 11:42:36 +0000
Local: Wed, Mar 5 2008 6:42 am
Subject: Re: getBoxObjectFor deprecated

arenev...@fdn.fr wrote:
>Problem is getBoundingClientRect will not get screenX. Should I still use getBoxObjectFor even if deprecated for html elements, or is there anothery way to get screen position of an element ?

Are you opening the popup as a result of a mouse event? Perhaps you
could use the screen and client coordinates of the mouse to calculate
the screen position of the element.

--
Warning: May contain traces of nuts.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Neil Deakin  
View profile  
 More options Mar 5 2008, 7:54 am
Newsgroups: mozilla.dev.tech.xul
From: Neil Deakin <enndea...@sympatico.ca>
Date: Wed, 05 Mar 2008 07:54:40 -0500
Local: Wed, Mar 5 2008 7:54 am
Subject: Re: getBoxObjectFor deprecated

arenev...@fdn.fr wrote:
> Hi,
> I need, from firefox chrome, to get screen position of an element in a web
> page (to show a popup to a position dependent of that element).  Therefore, I
> use:

> var doc = element.ownerDocument;
> var x = element.getBoundingClientRect().right
>         + doc.getBoxObjectFor(doc.documentElement).screenX
>         + doc.documentElement.scrollLeft;

> and I get right border position.

It would be better to just use the menupopup's openPopup method which
can position popups relative to other elements for you. The following
opens and aligns a popup with the right edge of an element:

popup.openPopup(element, "end_before");


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
arenev...@fdn.fr  
View profile  
 More options Mar 5 2008, 9:29 am
Newsgroups: mozilla.dev.tech.xul
From: arenev...@fdn.fr
Date: Wed, 05 Mar 2008 08:29:50 -0600
Local: Wed, Mar 5 2008 9:29 am
Subject: Re: getBoxObjectFor deprecated

Thanks,
at first, I did not want to use openPopup because I want the popup to be
"inside" element, and there is no position argument that can do that.

----------------------
|                    |
| element            |
|               _____|
|_______________|____| <- popup

But I had not noticed aX and aY arguments to that function. So now, I use:

popup.openPopup(element, "end_after", 0 - popupwidth);

I get popupwidth in popupshowing event first time popup appears.

Thanks for your help

arno


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »