Dislaying message from buttonClick()

I have a subclass of Window with a three buttons (“Save and Close”, “Save” and “Close”). The class implements Button.ClickListener. In buttonClick() I want t display a message, and disable the buttons, when “Save and Close” or “Close” is clicked, since the saving can take a few seconds due to heavy indexing. I have tried both adding a Label below the buttons and using showNotification(). The problem is that in both cases the message is not diplayed until buttonClick() has returned, i.e. after the save, even though I make the message call before the save call.

Is there a way to display a message immediately in this context?

Hi Nils,

What about to launch the save action in another thread? If you do this you can show the notification immediately and show a progressbar indicating that there is a process running in background.




running the heavy indexing in a separate thread might be a good idea anyway. If it works out well, I can add the progress bar later on. Thanks!

Look at
this sticky
to save you some research on how to get background threads working well.