Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Dropdown with a list widget
Dropdown with a list widget [message #78819] Fri, 21 March 2008 22:39 Go to next message
Arpit Desai is currently offline Arpit DesaiFriend
Messages: 25
Registered: July 2009
Junior Member
Hello All,

I am new to RAP and also to RCP. I wanted to find out if there is any
widget which will allow multiple selections on dropdown

or

when focus comes on a text-field we can create a list below that
text-field and allow user to select multiple items from that list.

I want to achieve this functionality in RAP. Currently I am using RAP
1.1 M1 target platform.

Please advice.

Thanks,

Arpit
Re: Dropdown with a list widget [message #78850 is a reply to message #78819] Sun, 23 March 2008 08:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: benjamin.wolff.web.de

hi,

a first idea on how to achieve this: you could add a focus listener on the
text widget which opens a new shell at the coords of the text widget. the
shell only contains a check table with the selectable items. the shell
closes upon loosing its focus and returns an array of the selected items.
if you need help or some examples with the codebase pls report back :).

greetings and happy easter!
-ben
Re: Dropdown with a list widget [message #79030 is a reply to message #78850] Mon, 24 March 2008 14:10 Go to previous messageGo to next message
Arpit Desai is currently offline Arpit DesaiFriend
Messages: 25
Registered: July 2009
Junior Member
Thanks Ben,

Sounds like a good idea, I am gonna give it a shot today and will report
back if run into any road-bumps.

Thanks again

Arpit

Ben W. wrote:
> hi,

>
> a first idea on how to achieve this: you could add a focus listener on
> the text widget which opens a new shell at the coords of the text
> widget. the shell only contains a check table with the selectable items.
> the shell closes upon loosing its focus and returns an array of the
> selected items. if you need help or some examples with the codebase pls
> report back :).
>
> greetings and happy easter!
> -ben
>
Re: Dropdown with a list widget [message #79103 is a reply to message #79030] Mon, 24 March 2008 18:59 Go to previous messageGo to next message
Arpit Desai is currently offline Arpit DesaiFriend
Messages: 25
Registered: July 2009
Junior Member
Hey Guys,

Here is a snippet of what I came up with but somehow its not working. I
am able to create and display the new shell but the List inside this new
shell is never displayed. I tried putting a simple text box too but that
didn't show up either.

What am I doing wrong here ?

Arpit

txtVersion.addFocusListener(new FocusAdapter() {
Shell sh;
Text widget;
List lst;
Composite c;
Display display;
public void focusGained(final FocusEvent event) {
widget = (Text)event.widget;
display = widget.getDisplay();
sh = new Shell(display.getCurrent().getActiveShell(), SWT.NO_TRIM);
System.out.println("x=" + widget.getLocation().x + "
y="+widget.getLocation().y);
sh.setLayout(new GridLayout());
sh.setLocation(widget.toDisplay(widget.getLocation()));
sh.setSize(widget.getSize().x, 100);
// Text t = new Text(sh, SWT.BORDER);
// t.setText("Typo");
lst = new List(sh, SWT.MULTI | SWT.V_SCROLL);
lst.setItems(new String[] { "1 - Hello", "2 - Hello", "3 - Hello",
"4 - Hello", "5 - Hello" });
lst.setVisible(true);
sh.open();
sh.redraw();

while (!sh.isDisposed()) {
if (!(display.readAndDispatch())) {
display.sleep();
}
}
}

@Override
public void focusLost(FocusEvent event) {
sh.close();
sh.dispose();
}
});

Arpit Desai wrote:
> Thanks Ben,
>
> Sounds like a good idea, I am gonna give it a shot today and will report
> back if run into any road-bumps.
>
> Thanks again
>
> Arpit
>
> Ben W. wrote:
>> hi,
>
>>
>> a first idea on how to achieve this: you could add a focus listener on
>> the text widget which opens a new shell at the coords of the text
>> widget. the shell only contains a check table with the selectable
>> items. the shell closes upon loosing its focus and returns an array of
>> the selected items. if you need help or some examples with the
>> codebase pls report back :).
>>
>> greetings and happy easter!
>> -ben
>>
Re: Dropdown with a list widget [message #79133 is a reply to message #79103] Mon, 24 March 2008 19:08 Go to previous message
Eclipse UserFriend
Originally posted by: fappel.innoopract.com

Hi,

which RAP-Version do you use? There was a bug #204556 that seems similar
to what you are describing. That bug is solved in CVS-Head. Just in
case...

Ciao
Frank

-----Ursprüngliche Nachricht-----
Von: Arpit Desai [mailto:arpitdesai23@gmail.com]
Bereitgestellt: Montag, 24. März 2008 20:00
Bereitgestellt in: eclipse.technology.rap
Unterhaltung: Dropdown with a list widget
Betreff: Re: Dropdown with a list widget


Hey Guys,

Here is a snippet of what I came up with but somehow its not working. I
am able to create and display the new shell but the List inside this new
shell is never displayed. I tried putting a simple text box too but that
didn't show up either.

What am I doing wrong here ?

Arpit

txtVersion.addFocusListener(new FocusAdapter() {
Shell sh;
Text widget;
List lst;
Composite c;
Display display;
public void focusGained(final FocusEvent event)
{
widget = (Text)event.widget;
display = widget.getDisplay();
sh = new
Shell(display.getCurrent().getActiveShell(), SWT.NO_TRIM);
System.out.println("x=" +
widget.getLocation().x + "
y="+widget.getLocation().y);
sh.setLayout(new GridLayout());

sh.setLocation(widget.toDisplay(widget.getLocation()));
sh.setSize(widget.getSize().x, 100);
// Text t = new Text(sh, SWT.BORDER);
// t.setText("Typo");
lst = new List(sh, SWT.MULTI |
SWT.V_SCROLL);
lst.setItems(new String[] { "1 - Hello",
"2 - Hello", "3 - Hello",
"4 - Hello", "5 - Hello" });
lst.setVisible(true);
sh.open();
sh.redraw();

while (!sh.isDisposed()) {
if
(!(display.readAndDispatch())) {
display.sleep();
}
}
}

@Override
public void focusLost(FocusEvent event) {
sh.close();
sh.dispose();
}
});

Arpit Desai wrote:
> Thanks Ben,
>
> Sounds like a good idea, I am gonna give it a shot today and will
> report back if run into any road-bumps.
>
> Thanks again
>
> Arpit
>
> Ben W. wrote:
>> hi,
>
>>
>> a first idea on how to achieve this: you could add a focus listener
>> on the text widget which opens a new shell at the coords of the text
>> widget. the shell only contains a check table with the selectable
>> items. the shell closes upon loosing its focus and returns an array
>> of the selected items. if you need help or some examples with the
>> codebase pls report back :).
>>
>> greetings and happy easter!
>> -ben
>>
Previous Topic:Color Dialog?
Next Topic:Images in TreeViewer
Goto Forum:
  


Current Time: Thu Apr 25 03:54:42 GMT 2024

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

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

Back to the top