Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » verifyText ignores <return>
verifyText ignores <return> [message #81253] Thu, 03 April 2008 20:46 Go to next message
Eclipse UserFriend
Originally posted by: leok83567.yahoo.com

I have a problem, that a VerifyListener added to an
org.eclipse.swt.widgets.Text starts the verifyText method on every key
pressed, but not for the <return> key.

I modified the "RAP Application with a View" example and replaced the
TableViewer widget with a Text widget.

Is the behaviour expected that the <return> key doesn't cause verifyText
to be executed? Can I catch newlines with a different Listener?

Regards
Leo
Re: verifyText ignores <return> [message #81269 is a reply to message #81253] Thu, 03 April 2008 21:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: benjamin.wolff.web.de

Hi!

Add a listener that listens to SWT.DefaultSelection, this should do it.

mfg
Ben W.


Leo K. schrieb:
> I have a problem, that a VerifyListener added to an
> org.eclipse.swt.widgets.Text starts the verifyText method on every key
> pressed, but not for the <return> key.
>
> I modified the "RAP Application with a View" example and replaced the
> TableViewer widget with a Text widget.
>
> Is the behaviour expected that the <return> key doesn't cause verifyText
> to be executed? Can I catch newlines with a different Listener?
>
> Regards
> Leo
>
Re: verifyText ignores <return> [message #81535 is a reply to message #81269] Fri, 04 April 2008 20:15 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: leok83567.yahoo.com

Adding a Listener to SWT.DefaultSelection didn't help.

I implemented VerifyListener,ModifyListener,SelectionListener and Listener
(see code below), but only the first two react. If I type foo<return>bar
in the Text widget, I get the following output:

verifyText() e.text="f"
modifyText()
verifyText() e.text="fo"
modifyText()
verifyText() e.text="foo"
modifyText()
verifyText() e.text="foo
b"
modifyText()
verifyText() e.text="foo
ba"
modifyText()
verifyText() e.text="foo
bar"
modifyText()

First strange thing is that in verifyText() the event.text always is the
complete text that has been typed so far, not just the last change.
Secondly, you see that there is one event with "foo" and the next with
"foo<return>b", but none with "foo<return>"!

Both is different from the same ViewParts behaviour in an RCP application.

Maybe I have to call some standard verifyText(), ... at the and of those
implemented functions or change the event.doit flag? However, this code
does what I expect it to do in an RCP, so my impression is this is a bug
in RAP.

I'd appreciate if somebody checks this ViewPart:

package testrap;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.events.VerifyListener;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.part.ViewPart;

public class View extends ViewPart implements
VerifyListener,ModifyListener,SelectionListener,Listener {
public void handleEvent(Event event) {
System.out.println("handleEvent()");
}
public void modifyText(ModifyEvent event) {
System.out.println("modifyText()");
}
public void verifyText(VerifyEvent e) {
System.out.println("verifyText() e.text=\""+e.text+"\"");
}
public void widgetDefaultSelected(SelectionEvent e) {
System.out.println("widgetDefaultSelected()");
}
public void widgetSelected(SelectionEvent e) {
System.out.println("widgetSelected()");
}

public static final String ID = "testrap.view";

private Text viewer;

public void createPartControl(Composite parent) {
int style = SWT.MULTI ;
viewer = new Text(parent, style);
viewer.addVerifyListener(this);
viewer.addModifyListener(this);
viewer.addSelectionListener(this);
viewer.addListener(SWT.DefaultSelection,this);
}

public void setFocus() {
}
}
Re: verifyText ignores <return> [message #81628 is a reply to message #81535] Sat, 05 April 2008 21:56 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: leok83567.yahoo.com

Does anybody have a look at the VerifyListener behaviour?

I hope my problem is clear from the example. Or is there an explanation
why Text widgets in RCP and RAP application listen differently to
<return>-key events?

Regards,
leo
Re: verifyText ignores <return> [message #81751 is a reply to message #81628] Mon, 07 April 2008 07:29 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: fappel.innoopract.com

Hi Leo,

sorry that we didn't react earlier to your post. We are currently very
busy preparing the M3 Release, so more complex questions may take a
little longer for response, but I got your problem scheduled.


Ciao
Frank

-----Ursprüngliche Nachricht-----
Von: Leo K. [mailto:leok83567@yahoo.com]
Bereitgestellt: Samstag, 5. April 2008 23:56
Bereitgestellt in: eclipse.technology.rap
Unterhaltung: verifyText ignores <return>
Betreff: Re: verifyText ignores <return>


Does anybody have a look at the VerifyListener behaviour?

I hope my problem is clear from the example. Or is there an explanation
why Text widgets in RCP and RAP application listen differently to
<return>-key events?

Regards,
leo
Re: verifyText ignores <return> [message #81955 is a reply to message #81628] Tue, 08 April 2008 11:09 Go to previous message
Eclipse UserFriend
Originally posted by: fappel.innoopract.com

Hi,

I took a look at your explanations and code-snippet. As you can imagine
providing a similar verify event mechanism in RWT as the one in SWT is
quite challenging. This is due to the distributed environment of client
and server and processing the events during a request cycle. So slightly
differences between the SWT and RWT behavior could be expected. But what
I get from your description I think the current solution is too far away
from the original SWT behavior. So feel free to file a bug and we will
see what we can do.


Ciao
Frank

-----Ursprüngliche Nachricht-----
Von: Leo K. [mailto:leok83567@yahoo.com]
Bereitgestellt: Samstag, 5. April 2008 23:56
Bereitgestellt in: eclipse.technology.rap
Unterhaltung: verifyText ignores <return>
Betreff: Re: verifyText ignores <return>


Does anybody have a look at the VerifyListener behaviour?

I hope my problem is clear from the example. Or is there an explanation
why Text widgets in RCP and RAP application listen differently to
<return>-key events?

Regards,
leo
Previous Topic:Full screen magic
Next Topic:verifyText ignores <return>
Goto Forum:
  


Current Time: Fri Apr 26 18:52:45 GMT 2024

Powered by FUDForum. Page generated in 0.02742 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top