Project

General

Profile

WStackedWidget prevents WMessageBox from showing

Added by Georg Wenig almost 3 years ago

My Wt application (Wt version 4.4.0) contains an "Export" button which is intended to perform the following actions:

  1. collect data from various widgets,
  2. validate the data,
  3. show a message box in case of validation errors,
  4. export the data as a text file.

The attached main.cpp shows a minimum example with a single spin-box (with value 0 considered an error)
for this setup, which can be compiled in two variants:

(i) with macro NO_WIDGET_STACK defined: In this case the application contains no WStackedWidget and everything works as expected.

(ii) with macro NO_WIDGET_STACK undefined: In this case the application contains a top-level WStackedWidget. Now, the "Validate"
button still works as expected, but the "Export" button does not: The data is made available for download, but the message box is
not shown until the download is finished and the user, e.g., clicks one of the spin box controls.

Any ideas on how to fix this situation?

main.cpp (2.98 KB) main.cpp Minimal example code

Replies (2)

RE: WStackedWidget prevents WMessageBox from showing - Added by Korneel Dumon almost 3 years ago

Thanks for the example, always helpful.
When I try this, it fails regardless of the macro. After looking at it a bit, I think the problem is with WResource::setTakesUpdateLock(), you should be able to work around it by manually taking the lock in handleRequest().

I also added it to our bug tracker: https://redmine.emweb.be/issues/8597

RE: WStackedWidget prevents WMessageBox from showing - Added by Georg Wenig almost 3 years ago

Thank you very much for the fast and helpful reply. Indeed, taking the update lock manually solves the problem.

For future reference, I have attached revision 1 of the example program which contains this workaround.

main_rev1.cpp (3.27 KB) main_rev1.cpp Minimal example code, revision 1
    (1-2/2)