I think that you need a deferred command to handle this. Limit your
clickhandler to set the infoLabel to "Beginning" and then launch a
deferred command who's execute method performs the search and then
updates the label.
In this way, the execution thread will finnish, causing the screen to
be updated with the beginning label and then only the defrred command
will be executed.

On 8 jul, 05:26, Shelley <[email protected]> wrote:
> thank Andreas and Aditya for your explanation.
>
> however the problem has nothing to do with RPC, the "search operation"
> i mentioned above is simply a local operation such as sort a large
> chunk of data which will take seconds to completed. meanwhile the
> client is unresponsive until the click OnClick() is completed, you can
> simply simulate this situation by doing a " while loop".
>
> is there other way i can see the "beginning..." ? or GWT has the
> ability to make UI responsive when it doing a time-consuming operation
> in client?
>
> thanks.
>
> -Shelley
>
> On Jul 7, 8:44 pm, andreas <[email protected]> wrote:
>
>
>
> > HeyShelley,
>
> > a bit of further information is missing but may it be that you issue
> > an RPC between infoLabel.setText("Beginning...."); and
> > infoLabel.setText("Completed....");?
>
> > If so you simply forgot the async nature of GWT RPC. Your code in
> > onClick(...) will not sort of stop or wait until the RPC finishes and
> > continue afterwards. That's why infoLabel.setText("Completed....");
> > will be immediately executed after infoLabel.setText("Beginning....");
> > and you're simply "way to slow" to see it.
>
> > What you could do instead is call infoLabel.setText("Completed....");
> > in your onSuccess(...) in case I'm right with RPC or in the callback
> > of whatever request you do for your search operation.
>
> > Andreas
>
> > On 7 Jul., 10:22,Shelley<[email protected]> wrote:
>
> > > hello all:
> > >    i came across a strange problem which seems quite simple:
>
> > >    i have a button and a label on a panel, the button has been
> > > registered a listener:
>
> > >   Button searchButton = new Button( "Search" );
> > >         searchButton.addClickHandler( new ClickHandler()
> > >         {
> > >             @Override
> > >             public void onClick( ClickEvent event )
> > >             {
> > >                 infoLabel.setText("Beginning....");
> > >                 //do a search operation here which will take more than
> > > 5 seconds...
> > >                 infoLabel.setText("Completed...");
> > >             }
> > >         } );
>
> > > that's all, but i never see the "Beginning....“ on the label, but only
> > > see the "completed...", seem the label will not refresh it's text
> > > until onClick is  finished? how can i achieved the function that
> > > display "beginning..." first and "Completed..." when the operation
> > > completed?
>
> > > thanks in advance.
>
> > > -Shelley

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

Reply via email to