Hi,

in the following example I have two diffferent dialogs. The first dialog
(BaseDialog) recieves a callback-function. This function creates a new
Dialog. Both dialogs are modal.
The dialog deletes itself, by clicking one of the Buttons.

When I push the "Ok"-Button in the first dialog, the content blocking
layer for modal dialogs disappears. When I push the "Close"-Button in
the second dialog, the layer appears even though no dialog exists.

The cause of the problem is the functionality of the "saveCoverState"
and "restoreCoverState" methods in the class "WDialog".
The second dialog is created before the first dialog is deleted,
therefore the first dialog hides the "cover", although the second dialog
still exists.

I know that this problem doesn't exist when I delete the first dialog,
before I create the second dialog, but in some cases i want the dialogs
to delete themselves.

Do you think this is a bug, or is this example just the completely wrong
practice?


class BaseDialog : public WDialog {

    std::function<void()> callback;

    void OnOk ()
    {
       callback();
       delete this;
    }

    void OnClose ()
    {
       delete this;
    }

public:
    BaseDialog (const std::function<void()>& callback) :
WDialog("Base"), callback(callback)
    {
       resize(400, 300);

       auto btnCOk = new WPushButton("Ok", contents());
       btnCOk->clicked().connect(this, &BaseDialog::OnOk);

       auto btnClose = new WPushButton("Close", contents());
       btnClose->clicked().connect(this, &BaseDialog::OnClose);
    }
};

(new BaseDialog(std::bind([] () {

    auto dialog = new Wt::WDialog("Following");
    dialog->resize(300, 200);

    auto btn = new WPushButton("Close", dialog->contents());
    btn->clicked().connect(std::bind([=] () {
       delete dialog;
    }));

    dialog->show();

})))->show();


Best regards,
Steven Pier

________________________________

GenoData EDV-Systeme GmbH
Oskar-von-Miller-Straße 2
76829 Landau

Internet: http://www.genodata.de
E-Mail: supp...@genodata.de
Telefon: 06341/558955
Fax: 06341/558954

Geschäftsführer: Katharina Lederle, Michael Blömer
Registergericht: Amtsgericht Landau
Sitz der Gesellschaft: Landau
Handelsregisternummer: HRB 2970
_____________________________________________________________________

GenoData - Bestes CRM-System 2012 - darauf sind wir stolz! Das spornt uns an!

Der Eisenhut-Award wird jährlich von den Fachzeitschriften Versicherungsmagazin
und Bankmagazin aus dem Wiesbadener Springer Gabler Verlag, dem Bundesverband
Deutscher Versicherungskaufleute (BVK) und KuBI e.V. verliehen. Weitere 
Informationen
finden Sie HIER<http://www.genodata.de/bestes-crm-genodata-edv-systeme-gmbh>.
_____________________________________________________________________

Der Versand und der Empfang von E-Mails dient der Beschleunigung der
Kommunikation und der Vorbereitung von Geschäftsabschlüssen bzw. der
Begleitung und Unterstützung der Kundenbetreuung. Auf dem Weg von
Absender zu Empfänger können E-Mails mitgelesen, verfälscht, nicht
oder verspätet zugestellt werden. Aus diesen Gründen können Verträge
und Willenserklärungen per E-Mail nicht wirksam abgeschlossen bzw.
abgegeben werden. Diese Erklärungen werden erst nach schriftlicher
Bestätigung wirksam.

------------------------------------------------------------------------------
Own the Future-Intel&reg; Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game 
on Steam. $5K grand prize plus 10 genre and skill prizes. 
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to