Yes, or a full solution that I just tested it works:

 public void onModuleLoad()
  {

    MultiWordSuggestOracle oracle = new MultiWordSuggestOracle();
    String[] words = {"Alpha", "Apple", "Anaconda", "Beta", "Beautiful", 
"Best", "Better"};
    for (String word: words)
    {
      oracle.add(word);
    }

    SuggestBox suggestBox = new SuggestBox(oracle);
    suggestBox.setSize("300px", "40px");

    
suggestBox.addSelectionHandler((SelectionEvent<SuggestOracle.Suggestion> 
suggestion) ->
    {
      GWT.log("SuggestBox Value: " + suggestBox.getValue());

      // You can also get the value this way from the event:
      GWT.log("Selected Value: " + 
suggestion.getSelectedItem().getReplacementString());
    });

    DockLayoutPanel p = new DockLayoutPanel(Style.Unit.EM);
    p.add(suggestBox);

    RootLayoutPanel rp = RootLayoutPanel.get();
    rp.add(p);
  }



On Friday, April 12, 2019 at 3:42:09 PM UTC-6, Filipe Sousa wrote:
>
> suggestionBox.getValue()?
>
> On Thursday, April 11, 2019 at 12:02:57 PM UTC+1, Nanditha Nandu wrote:
>>
>> final SuggestBox  suggestionBox = new SuggestBox(suggestions);
>>
>> where suggestions is the custom suggest words passed using 
>> MultiWordSuggestOracle
>>
>> Im trying to get the value selected from the suggestions in the 
>> SuggestBox using below line:
>>
>>  String text = suggestionBox.getTextBox().getValue();
>>
>> But the value of text is " "
>>
>> Please help.Thanks.
>>
>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to