News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

How show wxDialog?

Started by electrolot, October 19, 2008, 11:43:24 PM

Previous topic - Next topic

electrolot

I can't show wxDialog from my plugin. This is my code:

NewDialog* dlg = new NewDialog(Manager::Get()->GetAppWindow());
    if (dlg->Show() != wxID_OK)
        Manager::Get()->GetLogManager()->Log(_("Dialog Error"));



I always get "Dialog Error" and my dialog does not show. What I'm doing wrong?

Jenna

#1
You should look inside the wxWidgets-documentation.
Quote
wxDialog::Show
    bool Show(const bool show)
       
        Hides or shows the dialog.

    Parameters
        show
            If true, the dialog box is shown and brought to the front; otherwise the box is hidden. If false and the dialog is modal, control is returned to the calling program.

wxDialog::ShowModal
    int ShowModal()

        Shows a modal dialog. Program flow does not return until the dialog has been dismissed with wxDialog::EndModal.

    Return value

        The return value is the value set with wxDialog::SetReturnCode.

BTW:
this question is not C::B related, even if the error occurs while developping a plugin

electrolot

#2
I tried Show(true) and ShowModal(). I still have the same problem.
If I use ShowModal() in application (not in plugin) then it's works fine.

Jenna

If you really use ShowModal() and it does not work, it means that your dialog does not return wxID_OK.