Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How to get composite's location relative to screen
How to get composite's location relative to screen [message #439531] Tue, 13 July 2004 12:44 Go to next message
sibin is currently offline sibinFriend
Messages: 15
Registered: July 2009
Junior Member
Hi all,
I would like to know how we can get the position of a Control with
respect to screen.It will be a great help if somebody can give me the API
for that.
Thanks in advance
SIBIN
Re: How to get composite's location relative to screen [message #439532 is a reply to message #439531] Tue, 13 July 2004 13:19 Go to previous messageGo to next message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
See:

Display.map():

/**
* Maps a point from one coordinate system to another.
* When the control is null, coordinates are mapped to
* the display.
* <p>
* NOTE: On right-to-left platforms where the coordinate
* systems are mirrored, special care needs to be taken
* when mapping coordinates from one control to another
* to ensure the result is correctly mirrored.
*
* Mapping a point that is the origin of a rectangle and
* then adding the width and height is not equivalent to
* mapping the rectangle. When one control is mirrored
* and the other is not, adding the width and height to a
* point that was mapped causes the rectangle to extend
* in the wrong direction. Mapping the entire rectangle
* instead of just one point causes both the origin and
* the corner of the rectangle to be mapped.
* </p>
*
* @param from the source <code>Control</code> or <code>null</code>
* @param to the destination <code>Control</code> or <code>null</code>
* @param point to be mapped
* @return point with mapped coordinates
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the rectangle is null</li>
* <li>ERROR_INVALID_ARGUMENT - if the Control from or the Control to have
been disposed</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that
created the receiver</li>
* <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
* </ul>
*
* @since 2.1.2
*/
public Point map (Control from, Control to, Point point)


"sibin" <sibin@exorindia.com> wrote in message
news:cd0l46$abv$1@eclipse.org...
> Hi all,
> I would like to know how we can get the position of a Control with
> respect to screen.It will be a great help if somebody can give me the API
> for that.
> Thanks in advance
> SIBIN
>
>
Re: How to get composite's location relative to screen [message #439588 is a reply to message #439531] Wed, 14 July 2004 09:40 Go to previous message
Ryan is currently offline RyanFriend
Messages: 34
Registered: July 2009
Member
Hi Sibin,

Assuming the name of your Control is "control", I think you can call

control.toDisplay(new Point(0,0));

Ryan



sibin wrote:

> Hi all,
> I would like to know how we can get the position of a Control with
> respect to screen.It will be a great help if somebody can give me the API
> for that.
> Thanks in advance
> SIBIN
Previous Topic:what is invoked when Next button in wizard is pressed
Next Topic:Hyperlink in tableTreeViewer
Goto Forum:
  


Current Time: Thu Apr 25 18:57:39 GMT 2024

Powered by FUDForum. Page generated in 0.03029 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top