Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [platform-swt-dev] Text widget Listeners


Please take this discussion off of the developer's mailing list. This list is for use by the SWT developers to communicate details of the implementation work amongst themselves. In future, use the eclipse news groups for asking user questions.



"Donnie" <eclipse@xxxxxxxxxxx>
Sent by: platform-swt-dev-admin@xxxxxxxxxxx

25/09/03 00:32
Please respond to platform-swt-dev

       
        To:        <platform-swt-dev@xxxxxxxxxxx>
        cc:        
        Subject:        RE: [platform-swt-dev] Text widget Listeners



aki-

Another approach:

                text.addKeyListener(new KeyListener() {
                                 public void keyPressed(KeyEvent e) {
                                                  if(e.character == '\r' || e.character == '\n')
                                                                   doSomethingUseful(text.getText());
                                 }
                                 ...

I don't think the Text widget appends the '\n' or '\r' characters to its
text property but I am not positive.

-Donnie

> -----Original Message-----
> From: platform-swt-dev-admin@xxxxxxxxxxx [mailto:platform-swt-dev-
> admin@xxxxxxxxxxx] On Behalf Of JR Ruggentaler
> Sent: Wednesday, September 24, 2003 10:25 PM
> To: 'platform-swt-dev@xxxxxxxxxxx'
> Subject: RE: [platform-swt-dev] Text widget Listeners
>
> Does this help
>
>         text.addListener (SWT.DefaultSelection, new Listener()
>                                   {
>                                                    public void handleEvent (Event e)
>                                                    {
>                                                                     System.out.println (text.getText());
>                                                    }
>                                   });
>
> > -----Original Message-----
> > From: aki51@xxxxxxxxxxxxxxx [mailto:aki51@xxxxxxxxxxxxxxx]
> > Sent: Wednesday, September 24, 2003 6:50 PM
> > To: platform-swt-dev@xxxxxxxxxxx
> > Subject: [platform-swt-dev] Text widget Listeners
> >
> >
> > Hey folks,
> > So I've got a text widget that a user is filling out - when
> > he/she hit's Enter
> > (it is an SWT.SINGLE style text widget), I want an action to
> > be performed.  It
> > seems like I need a characterEvent to know what characters
> > are being added and
> > then check each event - selection, modify and verify seem to
> > not allow me to
> > look at the text and check if it ends with newline...any
> > ideas on how I can
> > detect this event?  Thanks!
> > -aki-
> >
> >
> > _______________________________________________
> > platform-swt-dev mailing list
> > platform-swt-dev@xxxxxxxxxxx
> > http://dev.eclipse.org/mailman/listinfo/platform-swt-dev
> >
> _______________________________________________
> platform-swt-dev mailing list
> platform-swt-dev@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/platform-swt-dev


_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-swt-dev


Back to the top