Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: electrolot on October 19, 2008, 11:43:24 pm

Title: How show wxDialog?
Post by: electrolot on October 19, 2008, 11:43:24 pm
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"));


I always get "Dialog Error" and my dialog does not show. What I'm doing wrong?
Title: Re: How show wxDialog?
Post by: Jenna on October 19, 2008, 11:57:08 pm
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
Title: Re: How show wxDialog?
Post by: electrolot on October 20, 2008, 12:09:02 am
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.
Title: Re: How show wxDialog?
Post by: Jenna on October 20, 2008, 12:28:39 am
If you really use ShowModal() and it does not work, it means that your dialog does not return wxID_OK.