Re: Question about SuggestBox.wrap

2009-06-11 Thread Thomas Broyer



On 11 juin, 00:38, Ben benzhe...@gmail.com wrote:
 I have a text box insides a FlexTable and I am trying to use
 SuggestBox.wrap to wrap the text box into a SuggestBox. Code snippet
 is like this.

 .
 FlexTable ft = new FlexTable();
 TextBox tb = new TextBox();

 ft.setWidget(0,0,tb);

 MultiWordSuggestOracle oracle = new MultiWordSuggestOracle();

 suggest = SuggestBox.wrap(oracle, tb.getElement());
 .

 But it throws error in hosted mode like this:

 java.lang.AssertionError: A widget that has an existing parent widget
 may not be added to the detach list
         at com.google.gwt.user.client.ui.RootPanel.detachOnWindowClose
 (RootPanel.java:122)
         at com.google.gwt.user.client.ui.SuggestBox.wrap(SuggestBox.java:
 267)...

 But it does not have this problem when you compile it and run it in
 browsers. I look into the source code of SuggestBox, it throws error
 in this line.

  266     suggestBox.onAttach();
  267     RootPanel.detachOnWindowClose(suggestBox);

 What is the problem? Is there a way to solve it?

Do not use wrap(), use the ctor instead.

FlexTable ft = new FlexTable();
TextBox tb = new TextBox();
MultiWordSuggestOracle oracle = new MultiWordSuggestOracle();
suggest = new SuggestBox(oracle, tb);

ft.setWidget(0,0,suggest);

--~--~-~--~~~---~--~~
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: Question about SuggestBox.wrap

2009-06-11 Thread Ben

It seems that is the only one to avoid it.

Thanks!

On Jun 11, 4:50 am, Thomas Broyer t.bro...@gmail.com wrote:
 On 11 juin, 00:38, Ben benzhe...@gmail.com wrote:





  I have a text box insides a FlexTable and I am trying to use
  SuggestBox.wrap to wrap the text box into a SuggestBox. Code snippet
  is like this.

  .
  FlexTable ft = new FlexTable();
  TextBox tb = new TextBox();

  ft.setWidget(0,0,tb);

  MultiWordSuggestOracle oracle = new MultiWordSuggestOracle();

  suggest = SuggestBox.wrap(oracle, tb.getElement());
  .

  But it throws error in hosted mode like this:

  java.lang.AssertionError: A widget that has an existing parent widget
  may not be added to the detach list
          at com.google.gwt.user.client.ui.RootPanel.detachOnWindowClose
  (RootPanel.java:122)
          at com.google.gwt.user.client.ui.SuggestBox.wrap(SuggestBox.java:
  267)...

  But it does not have this problem when you compile it and run it in
  browsers. I look into the source code of SuggestBox, it throws error
  in this line.

   266     suggestBox.onAttach();
   267     RootPanel.detachOnWindowClose(suggestBox);

  What is the problem? Is there a way to solve it?

 Do not use wrap(), use the ctor instead.

 FlexTable ft = new FlexTable();
 TextBox tb = new TextBox();
 MultiWordSuggestOracle oracle = new MultiWordSuggestOracle();
 suggest = new SuggestBox(oracle, tb);

 ft.setWidget(0,0,suggest);
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Question about SuggestBox.wrap

2009-06-10 Thread Ben

I have a text box insides a FlexTable and I am trying to use
SuggestBox.wrap to wrap the text box into a SuggestBox. Code snippet
is like this.

.
FlexTable ft = new FlexTable();
TextBox tb = new TextBox();

ft.setWidget(0,0,tb);

MultiWordSuggestOracle oracle = new MultiWordSuggestOracle();

suggest = SuggestBox.wrap(oracle, tb.getElement());
.


But it throws error in hosted mode like this:

java.lang.AssertionError: A widget that has an existing parent widget
may not be added to the detach list
at com.google.gwt.user.client.ui.RootPanel.detachOnWindowClose
(RootPanel.java:122)
at com.google.gwt.user.client.ui.SuggestBox.wrap(SuggestBox.java:
267)...

But it does not have this problem when you compile it and run it in
browsers. I look into the source code of SuggestBox, it throws error
in this line.

 266 suggestBox.onAttach();
 267 RootPanel.detachOnWindowClose(suggestBox);


What is the problem? Is there a way to solve it?

Thanks!
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---