Community
Participate
Working Groups
In an Italian Win2K system, WSAD's web services tool fills a Combo object with values and then calls the setText() method with a string which is in the list. Immediately afterwards, we call the getText() method expecting to get back the string which we had just set. However, we get something different. So far, we've only seen this on an Italian Win2K system.
Please clarify what "Something different" means. Ideally provide a test case including an example string and the resulting changed output. Also see the discussion in bug report 7709 to see if this is applicable.
"Something different": For example, we populate the Combo with items A, B, C and D. we then call the Combo's setText("B"). Immediately afterwards, we call the Combo's getText() and the return value is "C". I will try to put together a testcase.
Here is some code that shows this working on English Windows. Can you try it on Italian? public static void main (String [] args) { Display display = new Display (); Shell shell = new Shell (display); Combo combo = new Combo (shell, SWT.READ_ONLY); combo.setItems (new String [] {"A", "B", "C", "D"}); combo.setText ("B"); combo.pack (); shell.open (); System.out.println ("Text=" + combo.getText ()); while (!shell.isDisposed ()) { if (!display.readAndDispatch ()) display.sleep (); } display.dispose (); }
Steve, The test program you appended works in both Italian and English Win2K. I don't know if the fact that our Combo runs in the context of a Wizard may have any effect but I'm continuing to reduce it to a small, reproduceable test case. Thanks for your help so far. Regards, Yen Lu
We've narrowed this down. Our guess is that the implementation of the setText() method only compares a certain number of characters before declaring a match. There were two strings in our list with the first four words being the same. Here's the testcase: import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.SWT; public class TestClass { public static void main(String args[]) { Display display = new Display(); Shell shell = new Shell(display); Combo combo = new Combo(shell,SWT.READ_ONLY); System.out.println(combo.LIMIT); combo.setItems(new String[]{"Servizio Web URL","EJB Web service","Servizio Web bean Java di struttura","Servizio Web bean Java","Servizio Web DADX"}); combo.setText("Servizio Web bean Java"); System.out.println(combo.getText()); combo.pack(); shell.open(); System.out.println("Text = " + combo.getText()); while (!shell.isDisposed()) { if (display.readAndDispatch()) display.sleep(); } display.dispose(); } The output from this program is on Windows 2000 (both English and Italian) is: 2147483647 Servizio Web bean Java di struttura Text = Servizio Web bean Java di struttura As you can see, the string we actually got is a superset of the string we set the Combo to. This in addition to the fact that the superset string appears first in the list suggests to me that only a partial comparison is being performed. The code printing the Combo.LIMIT suggests to me that the strings should be small enough to make a sufficiently good comparison and not require any partial comparisons.
Fixed > 20020122.