Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development

How show wxDialog?

(1/1)

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


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


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

Jenna:
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.

--- End quote ---

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

electrolot:
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.

Navigation

[0] Message Index

Go to full version