Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » [Combo] Text Highlighting after SelectionChange by a Function
[Combo] Text Highlighting after SelectionChange by a Function [message #1495737] Tue, 02 December 2014 13:20 Go to next message
David Salomon is currently offline David SalomonFriend
Messages: 4
Registered: December 2014
Junior Member
Hello Very Happy

I have a problem with the combo. After i changed to the newest RAP Version 2.3.1 we got an issue with text highlighting in combos.

I create a simple example to show the problem:
public class BasicEntryPoint extends AbstractEntryPoint {

    @Override
    protected void createContents(Composite parent) {
        parent.setLayout(new GridLayout(2, false));
        final Combo combo = new Combo(parent, SWT.READ_ONLY | SWT.BORDER | SWT.DROP_DOWN);
        combo.setItems(new String[] { "Car" , "House" , "Tree" , "Shoe" [code][/code]});
        combo.select(0);
        Button button = new Button(parent, SWT.PUSH);
        button.setText("Switch Selection");
        button.addSelectionListener(new SelectionAdapter() {
        	@Override
        	public void widgetSelected(SelectionEvent e) {
        		int index = combo.getSelectionIndex();
        		combo.select(index < 3 ? index + 1 : index - 3);
        	}
		});
    }
}


If the selection gets changes by the button the new selected element gets highlighted.

Did i miss any new option to control this behavior. Before i change the RAP version it works fine.

I added 2 pictures, before and after the button got pressed.

Thanks for the reply. Cool

EDIT: index.php/fa/20102/0/ index.php/fa/20103/0/

[Updated on: Tue, 02 December 2014 15:02]

Report message to a moderator

Re: [Combo] Text Highlighting after SelectionChange by a Function [message #1495925 is a reply to message #1495737] Tue, 02 December 2014 16:34 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2334
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi David,
from your description I don't understand what is the problem. I've tried
your snippet against RAP 3.0M3 and everything looks good to me -
selection is changed and the selected item is highlighted in the list.
Could you explain more precisely what is the problem?
Best,
Ivan

--
Ivan Furnadjiev

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

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: [Combo] Text Highlighting after SelectionChange by a Function [message #1496982 is a reply to message #1495925] Wed, 03 December 2014 12:49 Go to previous messageGo to next message
David Salomon is currently offline David SalomonFriend
Messages: 4
Registered: December 2014
Junior Member
I would expect after i push the Button to switch the Selection the new selected Item is not highlighted.

If i switch the Selection "manual" (select in the Combolist) i expect the highlighting.

Im not sure how the highlighting should work. (maybe there is no difference between change the Selection manual or functional)

Maybe i have to improve the Snippt to make the difference clear.

[Updated on: Wed, 03 December 2014 12:50]

Report message to a moderator

Re: [Combo] Text Highlighting after SelectionChange by a Function [message #1497012 is a reply to message #1496982] Wed, 03 December 2014 13:19 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2334
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi,
according to STW Combo behavior there is no difference in highlighting -
in both cases (select from list and select by code) the selected item is
highlighted.
Best,
Ivan

--
Ivan Furnadjiev

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

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: [Combo] Text Highlighting after SelectionChange by a Function [message #1497047 is a reply to message #1497012] Wed, 03 December 2014 13:53 Go to previous messageGo to next message
David Salomon is currently offline David SalomonFriend
Messages: 4
Registered: December 2014
Junior Member
Okay thank you.
Re: [Combo] Text Highlighting after SelectionChange by a Function [message #1499649 is a reply to message #1497047] Fri, 05 December 2014 09:44 Go to previous messageGo to next message
David Salomon is currently offline David SalomonFriend
Messages: 4
Registered: December 2014
Junior Member
Hi again Wink

I'm trying to disable the highlighting (both cases: select from list an select by code). There seems to be no simple way, isnt it?

EDIT: Meanwhile i found out, after i add a second Combo to my Snippet only one Text gets highlighted (marked).

/***/
public class BasicEntryPoint extends AbstractEntryPoint {

    @Override
    protected void createContents(Composite parent) {
        parent.setLayout(new GridLayout(2, false));
        final Combo combo = new Combo(parent, SWT.NONE);
        combo.setItems(new String[]{"Car", "House", "Tree", "Shoe"});
        combo.select(0);
        final Combo combo2 = new Combo(parent, SWT.NONE);
        combo2.setItems(new String[]{"Car", "House", "Tree", "Shoe"});
        combo2.select(0);
        Button button = new Button(parent, SWT.PUSH);
        button.setText("Switch Selection");
        button.addSelectionListener(new SelectionAdapter() {
        	@Override
        	public void widgetSelected(SelectionEvent e) {
        		int index = combo.getSelectionIndex();
        		combo2.select(index < 3 ? index + 1 : index - 3);
        		combo.select(index < 3 ? index + 1 : index - 3);
        	}
		});
    }
}

[Updated on: Fri, 05 December 2014 13:07]

Report message to a moderator

Re: [Combo] Text Highlighting after SelectionChange by a Function [message #1567312 is a reply to message #1499649] Fri, 16 January 2015 09:23 Go to previous message
Sebastian Eckey is currently offline Sebastian EckeyFriend
Messages: 1
Registered: January 2015
Location: Germany
Junior Member
Hello,
I am experiencing the same issue as described.
I tried the snipped posted by David and you can see the issue there.
For my tests I used RAP 2.3.1.

When you run it you see two combos. When you click on the combo itself and changes the selection, the text of your selection gets highlighted. No problem here.

But when you click the button, the selection of the combo gets changed from outside the combo. There is no focus involved.
Both combos get the same input by the button, the button is clicked by the mouse.
After the click was performed the focus remains at the button.
The issues:
- The text of the selection of combo2 is selected, eventho the selection of combo2 gets changed before the first combo. Why that?
- When you press space now, you will click the button, the selection gets changed again.
- When you type some text, it will change the text inside the combo.
It just doesn't feel right.

Then I play a little bit around.
Next to each combo I placed a new Text. When the button gets pressed they get the text for the combo via getText.
The result: Combo2, the third item counted from the right in a row of five, highlights the text. In my opinion this looks weird.

Then I called setEnabled(false) on each combo.
Now I am able to set two focuses.
I click on the textfield, focus gets transferred to the textfield, no problem.
Then I click on the text inside of one of the combos.
The text of the combo gets highlighted, but the focus remains at the textfield, seen by the blue shadow around it.

	private class TestComposite extends Composite {
		public TestComposite(final Composite parent) {
			super(parent, SWT.NONE);
			setLayout(new GridLayout(5, false));

			final Combo combo = new Combo(this, SWT.NONE);
			final Text text = new Text(this, SWT.BORDER);

			final Combo combo2 = new Combo(this, SWT.NONE);
			final Text text2 = new Text(this, SWT.BORDER);

			final Button button = new Button(this, SWT.PUSH);

			combo.setItems(new String[] { "Car", "House", "Tree", "Shoe" });
			combo2.setItems(new String[] { "Car", "House", "Tree", "Shoe" });

			combo.select(new Random().nextInt(4));
			combo2.select(new Random().nextInt(4));

			button.setText("Switch Selection");
			button.addSelectionListener(new SelectionAdapter() {
				@Override
				public void widgetSelected(SelectionEvent e) {
					int index = combo.getSelectionIndex();
					
					combo2.select(index < 3 ? index + 1 : index - 3);
					combo.select(index < 3 ? index + 1 : index - 3);
					text.setText(combo.getText());
					text2.setText(combo.getText());

					combo.setEnabled(false);
					combo2.setEnabled(false);
				}
			});
		}
	}


Thanks in advance

Best,
Sebastian
Previous Topic:Generating test id for components not created programmatically
Next Topic:Modal and Modeless Shells
Goto Forum:
  


Current Time: Mon Feb 17 21:19:32 GMT 2020

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

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

Back to the top