Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Expected behaviour when removing from a Combo widget
Expected behaviour when removing from a Combo widget [message #1037546] Tue, 09 April 2013 13:39 Go to next message
Chris Boerger is currently offline Chris Boerger
Messages: 21
Registered: March 2012
Junior Member
I'm not sure if this is expected behaviour for the Combo Drop Down list so don't yell if it is.

When I programmatically remove an item by index from the possible values, the selected item gets changed.

i.e.

String[] options = new String[] {"One", "Two", "Three"};
Combo c = new Combo(...);

c.setItems(options);
c.select(1); // Set to "Two"
c.remove(0); // Remove "One"
System.out.println(c.getText()); // Will print out "Three"???
c.remove(0); // Remove "Two"
System.out.println(c.getText()); // Bad!

Why does removing an item from the list change the selection? That doesn't seem to make sense to me. I haven't tested this in an RCP so I don't know if it is the same there.

I'm using RAP 2.0
Re: Expected behaviour when removing from a Combo widget [message #1037957 is a reply to message #1037546] Wed, 10 April 2013 04:18 Go to previous message
Ivan Furnadjiev is currently offline Ivan Furnadjiev
Messages: 1778
Registered: July 2009
Senior Member
Hi Chris,
in SWT the first sysout prints "Two"... the second - empty string. Is
this what you expect? It seems that the behavior is different between
RAP and SWT. Please open a bugzilla and we will investigate it.
Thanks,
Ivan

On 4/9/2013 8:39 PM, Chris Boerger wrote:
> I'm not sure if this is expected behaviour for the Combo Drop Down
> list so don't yell if it is.
>
> When I programmatically remove an item by index from the possible
> values, the selected item gets changed.
>
> i.e.
>
> String[] options = new String[] {"One", "Two", "Three"};
> Combo c = new Combo(...);
>
> c.setItems(options);
> c.select(1); // Set to "Two"
> c.remove(0); // Remove "One"
> System.out.println(c.getText()); // Will print out "Three"???
> c.remove(0); // Remove "Two"
> System.out.println(c.getText()); // Bad!
>
> Why does removing an item from the list change the selection? That
> doesn't seem to make sense to me. I haven't tested this in an RCP so I
> don't know if it is the same there.
>
> I'm using RAP 2.0
>

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Previous Topic:CSS and font size
Next Topic:IE8 double click on tree/table problem.
Goto Forum:
  


Current Time: Mon Jul 28 22:47:35 EDT 2014

Powered by FUDForum. Page generated in 0.03306 seconds