Tuesday, February 9, 2016

Re: TextBox fails to show updated text

Jens:

I appreciate you taking time to verify the issue.  Yes, I was continuing to diagnose the issue after posting this question and found the bug.  The object that called the setMessage(...) method created its own instance of the view.  That view was not connected to the UI at all.  Similar to what you said.  After fixing it I couldn't get back to this posting to update it.

Thanks 
Sam V

On Tuesday, February 9, 2016 at 2:38:00 AM UTC-5, Velusamy Velu wrote:
Friends:

I have been working with GWT for the past 18 months and I have been able to achieve considerably.  A pilot version of my application is available at http://peruselab.com/.

However, I landed in a major trouble with the code and I'm quite not sure how to resolve.  To narrow down and focus on the crux of the issue I simplified the code as below.

I have a UiBinder with the content

<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" 
        xmlns:g="urn:import:com.google.gwt.user.client.ui">
<ui:style>
</ui:style>
<g:HTMLPanel styleName="userContent">
<g:TextBox ui:field="messageTextBox" />
</g:HTMLPanel>
</ui:UiBinder>

and a snippet of the corresponding Java code:


@UiField
TextBox messageTextBox;

public UserContent() {
initWidget(uiBinder.createAndBindUi(this));
messageTextBox.setText("Message to user goes here"); 
}

public void setMessage(String message) {
messageTextBox.setText(message); // fails to work.
}

The last line of Java code in red seems like a very simple statement but fails to work.  I even tried messageText.setValue(message) with no resolution. The textBox just couldn't be updated with a new message.  I have tried stepping through the code in debug mode and found that the code indeed updates the TextBox.  But the new value just doesn't show up in the UI.

Does any one have any idea?

Thanks
Sam V

--
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+unsubscribe@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.

No comments:

Post a Comment