Community
Participate
Working Groups
Build Identifier: 20100218-1602 Greetings: I am attempting to set a text limit on a Text widget and the widget is just allowing unlimited entry. coding as follows Text testText = new Text(testAreaComposite, SWT.NONE); testText.setLayoutData(new TableWrapLayout(TableWrapLayout.FILL)); testText.setTextLimit(10); The text widget is drawing fine but will not limit the user to 10 characters, as expected. Thanks for your time. JODowd Reproducible: Always
I'll assume you're using Cocoa, given how recent the build is.
I can't reproduce this on 3.6rc4 in ControlExample. I can set a limit of 20 (for example) and can't type or paste beyond that. How are you determining that you have a bug?
We are using SWT 3.6. I am on an intel Mac running OSX10.6.3. I ran the code snippet that I provided in the original bug description. The text widget appears but does not limit the chars. A fellow developer in our office is on a PC running Windows XP. The same code is working on his machine and the character limit is enforced as expected... Josh (In reply to comment #2) > I can't reproduce this on 3.6rc4 in ControlExample. I can set a limit of 20 > (for example) and can't type or paste beyond that. > > How are you determining that you have a bug?
Please attach a complete SWT example that demonstrates the bug. I'm not able to reproduce this with ControlExample, and the snippet below doesn't compile (TableWrapLayout has no FILL constant, for example.) Thanks!
Yeah, Sorry, try this: import org.eclipse.swt.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; public class LimitExample { public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(); shell.setLayout(new GridLayout(1, true)); Text text; text = new Text(shell, SWT.NONE); text.setTextLimit(10); text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); } } This compiles, runs, draws, but does not limit chars on my machine... ***Note: I have to have an environment variable (-d32) set on my eclipse run config to run any SWT 32 bit because I am on a 64 bit Mac. Josh (In reply to comment #4) > Please attach a complete SWT example that demonstrates the bug. I'm not able to > reproduce this with ControlExample, and the snippet below doesn't compile > (TableWrapLayout has no FILL constant, for example.) Thanks!
The only thing I can suggest is to try a later build of 3.6. With the HEAD revision of SWT on I20100603-1500 it works as expected. I can type 10 characters and then keystrokes are ignored. You are using Cocoa, right?
Thanks for your time... We are developing under eclipse 3.5 but are bundling and deploying with 3.6 SWT jars, so this works on my machine if I run the deployed product but does not work in my development environment. Thanks again. Josh O'Dowd (In reply to comment #6) > The only thing I can suggest is to try a later build of 3.6. With the HEAD > revision of SWT on I20100603-1500 it works as expected. I can type 10 > characters and then keystrokes are ignored. You are using Cocoa, right?
As noted, working in 3.6. We won't be releasing a 3.5 update.