KeyPressevent is being called twice for suggest box - Please help!!!!!

2011-04-19 Thread Nisha

Hi All,

Here is the code I have for suggest box. But the code inside the
keypress event is being called twice. Please help


box = new SuggestBox(objOracle);
box.addKeyPressHandler(new KeyPressHandler() {

public void onKeyPress(KeyPressEvent event) {
System.out.println(iN kEY pRESS EVENT);
if (event.getCharCode() == KeyCodes.KEY_ENTER){

mappingTable.populateTable(box.getText()); //being called twice
}
}
});

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: KeyPressevent is being called twice for suggest box - Please help!!!!!

2011-04-19 Thread Ben Imp
I believe you are hitting this.

http://code.google.com/p/google-web-toolkit/issues/detail?id=3533

There's a few suggestions in there for how to go about fixing it.  I ended 
up creating a de-duping Handler that wont fire its delegate when it gets 
called for the duplicate event.

-Ben

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: KeyPressevent is being called twice for suggest box - Please help!!!!!

2011-04-19 Thread Thomas Broyer
Best to simply add the event handler to the SuggestBox's TextBox!

   suggestBox.getTextBox().addKeyPressHandler(handler);

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: KeyPressevent is being called twice for suggest box - Please help!!!!!

2011-04-19 Thread Shilpa
Thanks Broyer. You helped a lot. It worls :)

On Tue, Apr 19, 2011 at 12:16 PM, Thomas Broyer t.bro...@gmail.com wrote:

 Best to simply add the event handler to the SuggestBox's TextBox!

suggestBox.getTextBox().addKeyPressHandler(handler);

 --
 You received this message because you are subscribed to the Google Groups
 Google Web Toolkit group.
 To post to this group, send email to google-web-toolkit@googlegroups.com.
 To unsubscribe from this group, send email to
 google-web-toolkit+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/google-web-toolkit?hl=en.




-- 
Thanks and Regards,

Shilpa Kintali
Ph: 585-278-3543

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: KeyPressevent is being called twice for suggest box - Please help!!!!!

2011-04-19 Thread Ben Imp
That seems a lot simpler than what I did.  Awesome.

-Ben

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: KeyPressevent is being called twice for suggest box - Please help!!!!!

2011-04-19 Thread karthik reddy
Is the real culprit for this behavior the following lines in the 
addEventsToTextBox() method  of SuggestBox class:

*delegateEvent(SuggestBox.this, event);*

I think there are about 4 occurrences of this in the addEventsToTextBox() 
method:

http://code.google.com/p/google-web-toolkit/issues/detail?id=3533#c9   
Joel's comment seems to indicate the same.

Do you guys agree ??


-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.