Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Setting initial position of a PopupDialog
Setting initial position of a PopupDialog [message #201684] Mon, 26 March 2007 09:36 Go to next message
Eclipse UserFriend
Originally posted by: aniket.patil.wipro.com

I have a table displayed in one of my views. When i click on a particular
row in my table, a PopupDialog is displayed which shows a list of
operations available for the table row (Edit and Delete the row).

I need the PopupDialog to be displayed next to where i have clicked. Since
the default inital position for a Dialog is taken from the Window class
(which displays it in the centre of the screen), i am overriding the

protected Point getInitialLocation(Point initialSize) {}

method, by returning a new Point(x,y). To get the x and y co-ordinates, i
have a selectionListener for the table. From the SelectionEvent object of

public void widgetSelected(SelectionEvent e),

i get e.x and e.y and set them to x and y of the above point.

According the API description, e.x and e.y give the co-ordinates of the
selected area. However, their value always turns out to be 0. The Point
returned from getInitialLocation is (0,0) and hence the PopupDialog is
always in the left hand corner of the screen.

How do i get the current x and y postion (of the point i click on the
table), so that i can position the dialog close to my click?
Re: Setting initial position of a PopupDialog [message #202918 is a reply to message #201684] Tue, 03 April 2007 04:13 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: aniket.patil.wipro.com

Any suggestions guys?
Re: Setting initial position of a PopupDialog [message #203031 is a reply to message #202918] Tue, 03 April 2007 17:38 Go to previous message
Eclipse UserFriend
Originally posted by: dtoland.email.uophx.edu

I am assuming that you are referring to a JDialog, but this would also apply to any class derived from
java.jwt.Component. Either:

void setLocation(int x, int y)
or
void setLocation(java.awt.Point)

should work for you.

--
Dave Toland
dave.toland@verizon.net

"Aniket S. Patil" <aniket.patil@wipro.com> wrote in message news:b84a2befb108d1776f617f10e73d9e81$1@www.eclipse.org...
| Any suggestions guys?
|
Previous Topic:Characters cannot be mapped
Next Topic:Launch Configuration Hell
Goto Forum:
  


Current Time: Sat Sep 21 07:14:07 GMT 2024

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

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

Back to the top