Skip to content

Commit 6e35f30

Browse files
author
soheil_h_y
committed
1. Modify Listener of text works now.
1 parent 0b14817 commit 6e35f30

File tree

1 file changed

+15
-5
lines changed
  • sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets

1 file changed

+15
-5
lines changed

sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets/Text.java

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ void createHandle () {
226226
* @see org.eclipse.swt.widgets.Widget#hookKeyDown()
227227
*/
228228
void hookKeyDown() {
229+
229230
textHandle.onkeydown = new RunnableCompatibility() {
230231
public void run() {
231232
boolean verifyHooked = false;
@@ -278,10 +279,19 @@ void hookModify() {
278279
/*
279280
* TODO: Maybe pasting string into Text component should be limited.
280281
*/
281-
textHandle.onchange = new RunnableCompatibility() {
282+
/*
283+
* I have changed, the change event to onkeyup. I think change is
284+
* just fired after the blur.
285+
*/
286+
textHandle.onkeyup = new RunnableCompatibility() {
282287
public void run() {
283-
if ((style & SWT.READ_ONLY) != 0
284-
|| (!hooks (SWT.Verify) && !filters (SWT.Verify))) {
288+
if ((style & SWT.READ_ONLY) != 0
289+
/*
290+
* I have changed !hooks (SWT.Verify) && !filters (SWT.Verify)) to
291+
* hooks (SWT.Verify) && !filters (SWT.Verify))
292+
* I do not know what is the rational behind the first.
293+
*/
294+
|| (hooks (SWT.Verify) && !filters (SWT.Verify))) {
285295
toReturn(true);
286296
return ;
287297
}
@@ -293,14 +303,14 @@ public void run() {
293303
toReturn(true);
294304
return ;
295305
}
296-
if (!newText.equals (oldText)) {
306+
//if (!newText.equals (oldText)) {
297307
Event e = new Event();
298308
e.type = SWT.Modify;
299309
e.item = Text.this;
300310
e.widget = Text.this;
301311
sendEvent(e);
302312
toReturn(e.doit);
303-
}
313+
//}
304314
}
305315
}
306316
};

0 commit comments

Comments
 (0)