Setting the Maximum Length for Entries
Since
the
SWT.DROP_DOWN
-style combo has an editable text
field into which the user can enter data, it is useful to be able to
set a limit on the number of characters of text that may be entered.
As discussed in the context of the Text
class in
Chapter 5, this is sometimes necessary to
prevent database errors if the text entered is used to insert or
update records in a database.
How do I do that?
As with the Text
class,
the following code will set a limit on entry:
c.setTextLimit(25);
Get SWT: A Developer's Notebook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.