Project

General

Profile

Actions

Bug #2005

closed

Problem when using more than one Modal Dialog

Added by Ariel Kruger almost 11 years ago. Updated over 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
07/02/2013
Due date:
% Done:

0%

Estimated time:

Description

I am having some problems when using two modal WDialogs,

The problem occur when the first dialog is closed and second is showed...

The first seems to close the modal and unblock the content of the application and it seems the second WDialog is not a

modal dialog anymore, and later when the second modal is closed, the background that blocks the application appear and block when it's not supposed to appear again...

        WDialog *dialog = new WDialog("Title Dialog");

        Wt::WPushButton *confirm = new Wt::WPushButton("Confirm", dialog->footer());
        Wt::WPushButton *cancel = new Wt::WPushButton("Cancel", dialog->footer());

        confirm->clicked().connect(std::bind([=] () {
            openDialogConfirmation();
            dialog->accept();

        }));

        cancel->clicked().connect(std::bind([=] () {
            dialog->reject();
        }));

        dialog->finished().connect(std::bind([=] () {
            delete dialog;
        }));

        dialog->show();


void openDialogConfirmation(){
        WDialog *secondDialog = new WDialog("Title Second Dialog");

        Wt::WPushButton *confirm = new Wt::WPushButton("Confirm", secondDialog->footer());
        Wt::WPushButton *cancel = new Wt::WPushButton("Cancel", secondDialog->footer());

        confirm->clicked().connect(std::bind([=] () {
            secondDialog->accept();  
        }));

        cancel->clicked().connect(std::bind([=] () {
            secondDialog->reject();
        }));

        secondDialog->finished().connect(std::bind([=] () {
            delete secondDialog;
        }));

        secondDialog->show();
}

could someone check it...

Thank you

Actions #1

Updated by Koen Deforche almost 11 years ago

  • Status changed from New to InProgress
  • Assignee set to Koen Deforche
  • Target version set to 3.3.1
Actions #2

Updated by Koen Deforche over 10 years ago

  • Status changed from InProgress to Resolved

Hey,

This is an old known problem, see also #1512: the dialog code was expecting dialogs to be created/destroyed as they are stacked. A workaround for you code is to reverse the lines:

openDialogConfirmation();
dialog->accept();

But it's not nice of Wt to be so silly about this, and I got around to fix this though today and a fix is on its way in git!

Regards,

koen

Actions #3

Updated by Koen Deforche over 10 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF