Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Problem about Focus on Combo
Problem about Focus on Combo [message #485338] Fri, 11 September 2009 12:24 Go to next message
Eclipse UserFriend
Originally posted by: sjungjariyanonn.fininfo.fr

Hi,
I have 2 combos, the first one is filled and enabled, the second one is
empty and disabled.
There is a listener on the first one. When an item is selected, we fill
the second combo and we enable it.
Then we give the focus to the first combo but it seems that it doesn't
work. The focus remains on the second combo!
Does someone know something about it?

Thank you in advance for your help.
Best regards,

JUNG
Re: Problem about Focus on Combo [message #485623 is a reply to message #485338] Mon, 14 September 2009 08:18 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2427
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi Jung,

which version of RAP are you using? Can you provide a small snippet that
demonstrate the problem?

Best,
Ivan

JUNG wrote:
> Hi, I have 2 combos, the first one is filled and enabled, the second
> one is empty and disabled. There is a listener on the first one. When
> an item is selected, we fill the second combo and we enable it.
> Then we give the focus to the first combo but it seems that it doesn't
> work. The focus remains on the second combo! Does someone know
> something about it?
> Thank you in advance for your help. Best regards,
>
> JUNG
>
>
Re: Problem about Focus on Combo [message #487456 is a reply to message #485623] Wed, 23 September 2009 10:24 Go to previous messageGo to next message
JUNG  is currently offline JUNG Friend
Messages: 3
Registered: September 2009
Junior Member
Hello Ivan,

The version used is RAP 1.2.0.R.

Here is a sample code showing our problem.
At the beginning, when we select "2" in the first Combo,
the second Combo is filled and the focus remains on it.
If we select again "2", the focus is correctly put on the first Combo.

Thank you.

JUNG

// =================================

public class Testtesttest
{
public Testtesttest()
{
Display display = PlatformUI.createDisplay();
final Shell shell = new Shell(display);
shell.setSize(300, 300);
shell.setLayout(new RowLayout());

shell.setText("Composite Example");

final Composite parent = new Composite(shell, SWT.NONE);
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 4;
parent.setLayout(gridLayout);

Composite container = new Composite(parent, SWT.BORDER);
GridLayout layout = new GridLayout();
gridLayout.numColumns = 1;
container.setLayout(layout);
GridData gridData = new GridData(SWT.LEFT, SWT.FILL, true, false);
container.setLayoutData(gridData);

final Label fictif = new Label(container, SWT.NONE);
gridData = new GridData(SWT.LEFT, SWT.FILL, true, false);
fictif.setLayoutData(gridData);
fictif.setText("test");

// First combo
final Combo combo1 = new Combo(container, SWT.NONE);
gridData = new GridData(SWT.LEFT, SWT.FILL, true, false);
combo1.setLayoutData(gridData);
combo1.add("0");
combo1.add("1");
combo1.add("2");

final Text text = new Text(container, SWT.NONE);
gridData = new GridData(SWT.LEFT, SWT.FILL, true, false);
text.setLayoutData(gridData);

final Combo combo2 = new Combo(container, SWT.NONE);
gridData = new GridData(SWT.LEFT, SWT.FILL, true, false);
combo2.setLayoutData(gridData);
combo2.setEnabled(false);

combo1.addSelectionListener(new SelectionListener()
{

@Override
public void widgetDefaultSelected(SelectionEvent e)
{
// TODO Auto-generated method stub

}

@Override
public void widgetSelected(SelectionEvent e)
{
if (combo1.getSelectionIndex() == 2)
{
combo2.setEnabled(true);
fictif.setEnabled(false);
combo2.add("aaaaaaaaaa");
combo2.add("bbbbbbbbbbbbb");
combo2.add("cccccccccccccccccccccccccccc");
combo2.select(1);
combo2.pack();
combo1.setFocus();
}
}
});

shell.open();
while (!shell.isDisposed())
{
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}
Re: Problem about Focus on Combo [message #487566 is a reply to message #487456] Wed, 23 September 2009 15:29 Go to previous message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2427
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi JUNG,

we have recently fixed the bug:

289398: [Combo] Highlighting misbehaviour while setting selection
programmatically
https://bugs.eclipse.org/bugs/show_bug.cgi?id=289398

Your problem is not reproducible any more with CVS HEAD.

Best,
Ivan

JUNG wrote:
> Hello Ivan,
> The version used is RAP 1.2.0.R.
> Here is a sample code showing our problem. At the beginning, when we
> select "2" in the first Combo, the second Combo is filled and the
> focus remains on it.
> If we select again "2", the focus is correctly put on the first Combo.
> Thank you.
>
> JUNG
>
> // =================================
> public class Testtesttest
> {
> public Testtesttest()
> {
> Display display = PlatformUI.createDisplay();
> final Shell shell = new Shell(display);
> shell.setSize(300, 300);
> shell.setLayout(new RowLayout());
>
> shell.setText("Composite Example");
>
> final Composite parent = new Composite(shell, SWT.NONE);
> GridLayout gridLayout = new GridLayout();
> gridLayout.numColumns = 4;
> parent.setLayout(gridLayout);
> Composite container = new Composite(parent, SWT.BORDER);
> GridLayout layout = new GridLayout();
> gridLayout.numColumns = 1;
> container.setLayout(layout);
> GridData gridData = new GridData(SWT.LEFT, SWT.FILL, true, false);
> container.setLayoutData(gridData);
>
> final Label fictif = new Label(container, SWT.NONE);
> gridData = new GridData(SWT.LEFT, SWT.FILL, true, false);
> fictif.setLayoutData(gridData);
> fictif.setText("test");
>
> // First combo
> final Combo combo1 = new Combo(container, SWT.NONE);
> gridData = new GridData(SWT.LEFT, SWT.FILL, true, false);
> combo1.setLayoutData(gridData);
> combo1.add("0");
> combo1.add("1");
> combo1.add("2");
>
> final Text text = new Text(container, SWT.NONE);
> gridData = new GridData(SWT.LEFT, SWT.FILL, true, false);
> text.setLayoutData(gridData);
>
> final Combo combo2 = new Combo(container, SWT.NONE);
> gridData = new GridData(SWT.LEFT, SWT.FILL, true, false);
> combo2.setLayoutData(gridData);
> combo2.setEnabled(false);
>
> combo1.addSelectionListener(new SelectionListener()
> {
>
> @Override
> public void widgetDefaultSelected(SelectionEvent e)
> {
> // TODO Auto-generated method stub
>
> }
>
> @Override
> public void widgetSelected(SelectionEvent e)
> {
> if (combo1.getSelectionIndex() == 2)
> {
> combo2.setEnabled(true);
> fictif.setEnabled(false);
> combo2.add("aaaaaaaaaa");
> combo2.add("bbbbbbbbbbbbb");
> combo2.add("cccccccccccccccccccccccccccc");
> combo2.select(1);
> combo2.pack();
> combo1.setFocus();
> }
> }
> });
> shell.open();
> while (!shell.isDisposed())
> {
> if (!display.readAndDispatch())
> display.sleep();
> } display.dispose();
> }
> }
>
Previous Topic:[ANN] CVS HEAD requires new dependency
Next Topic:FileUpload
Goto Forum:
  


Current Time: Thu Oct 03 17:20:33 GMT 2024

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

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

Back to the top