SWT and Text editing

SWT Designer allows you to create the views, editors, perspectives, pref pages, composites, etc. that comprise Eclipse SWT & RCP applications and plug-ins.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

SWT and Text editing

Postby hellfire » Fri May 20, 2005 4:53 am

i've another question for the forum's expert! :roll:

i've the necessity to use a text field with the capacity to accept only numeric chars . SWT Designer can do that ???

thanx :lol:
hellfire
 
Posts: 4
Joined: Mon May 16, 2005 4:51 am

Re: SWT and Text editing

Postby Eric Clayberg » Fri May 20, 2005 5:19 am

hellfire wrote:i've the necessity to use a text field with the capacity to accept only numeric chars . SWT Designer can do that ?

Yes. That is quite easy. SWT itself does not include a masked text field, but you can create one easy enough using a verify text listener...

Code: Select all
Text field = new Text(group, SWT.BORDER);
field.addVerifyListener(new VerifyListener() {
    public void verifyText(VerifyEvent e) {
        e.doit = Character.isDigit(e.character);
    }
});

You can check for any characters that you like, so you could also allow periods, dashes, backspaces, etc.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Postby hellfire » Fri May 20, 2005 5:29 am

it would be usefull including an enanched version of SWT text component with this capability in the SWT designer next release 8)
hellfire
 
Posts: 4
Joined: Mon May 16, 2005 4:51 am

Postby Eric Clayberg » Fri May 20, 2005 10:03 am

hellfire wrote:it would be usefull including an enanched version of SWT text component with this capability in the SWT designer next release

We don't plan to add any enhanced widgets directly to SWT Designer. If we do provide any new SWT widgets, they would be part of an add-on package.

If Eclipse.org decides to add any enhanced text widgets to the SWT base, we would, of course, support them.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA


Return to SWT Designer

Who is online

Users browsing this forum: No registered users and 1 guest