Setting initial position of a PopupDialog [message #201684] |
Mon, 26 March 2007 05:36  |
Eclipse User |
|
|
|
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?
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.11345 seconds