Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » PopupList questions
PopupList questions [message #445190] Wed, 27 October 2004 20:12 Go to next message
Aashish Patil is currently offline Aashish PatilFriend
Messages: 39
Registered: July 2009
Member
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 #445216 is a reply to message #445190] Thu, 28 October 2004 14:00 Go to previous messageGo to next message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
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
>
>
Re: PopupList questions [message #445225 is a reply to message #445216] Thu, 28 October 2004 19:09 Go to previous message
Aashish Patil is currently offline Aashish PatilFriend
Messages: 39
Registered: July 2009
Member
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
> >
> >
>
>
Previous Topic:Removing children from a canvas ruins layout
Next Topic:different charsets
Goto Forum:
  


Current Time: Sun Oct 25 18:00:57 GMT 2020

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

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

Back to the top