PopupList questions [message #445190] |
Wed, 27 October 2004 16:12  |
Eclipse User |
|
|
|
Hello,
I am trying to use a popup list within my plugin. The list opened from
within an JFace Action.
1. How do I enable scrollbars. I tried providing SWT.H_SCROLL | SWT.V_SCROLL
in the
constructor but no effect.
2. How do I get the current mouse position on the screen? I tried
Display.getCurrent().getCursorLocation(); However, that does not seem to be
returning the correct mouse location. I passed in the x,y values provided by
this method to the PopupList.open() but it does not open up next to the
mouse.
Thank you
Regards,
Aashish
|
|
|
|
Re: PopupList questions [message #445225 is a reply to message #445216] |
Thu, 28 October 2004 15:09  |
Eclipse User |
|
|
|
Hi Steve,
My snippet is after this mail body. I did manage to get it working.
Some points:
- The PopupList.open(Rectangle) documentation is a bit confusing. It seemed
to me that it meant the size of the popup list rectangle that is drawn.
However, the height in the rectangle is interpretated to be the distance
below the x,y coordinates from which the popup list starts to get drawn.
Due to this if my code mentioned 100 it start drawing 100 units below the
mouse pointer. Finally, I reduced it to 10 so it would start drawing near
the mouse pointer. Thus, it was not a problem with Display class as I had
mentioned in my email.
- The PopupList 2 argument constructor seems to be having the following line
list = new List(shell, SWT.SINGLE | SWT.V_SCROLL);
Does it mean that the V_SCROLL is hardcoded into it and one cannot have a
H_SCROLL? I have
been unable to get the H_SCROLL working as yet.
Thank you
Regards,
Aashish
Code Snippet:
PopupList oldQueryListBox = new
PopupList(QueryView.this.getSite().getShell(), SWT.H_SCROLL | SWT.V_SCROLL);
oldQueryListBox.setItems(getOldQueryList());
String selectedQuery = oldQueryListBox.open(rect);
"Steve Northover" <steve_northover@ca.ibm.com> wrote in message
news:clqu16$3a3$1@eclipse.org...
> Please post a small stand alone snippet for us to debug. Thanks.
>
> "Aashish Patil" <aashisheclipse@hotmail.com> wrote in message
> news:clovg5$m2q$1@eclipse.org...
> > Hello,
> >
> > I am trying to use a popup list within my plugin. The list opened from
> > within an JFace Action.
> >
> > 1. How do I enable scrollbars. I tried providing SWT.H_SCROLL |
> SWT.V_SCROLL
> > in the
> > constructor but no effect.
> >
> > 2. How do I get the current mouse position on the screen? I tried
> > Display.getCurrent().getCursorLocation(); However, that does not seem to
> be
> > returning the correct mouse location. I passed in the x,y values
provided
> by
> > this method to the PopupList.open() but it does not open up next to the
> > mouse.
> >
> >
> >
> > Thank you
> > Regards,
> > Aashish
> >
> >
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03413 seconds