Author Topic: How show wxDialog?  (Read 7439 times)

Offline electrolot

  • Multiple posting newcomer
  • *
  • Posts: 18
How show wxDialog?
« on: October 19, 2008, 11:43:24 pm »
I can't show wxDialog from my plugin. This is my code:

Code: [Select]
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?

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: How show wxDialog?
« Reply #1 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

Offline electrolot

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: How show wxDialog?
« Reply #2 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.
« Last Edit: October 20, 2008, 12:14:01 am by electrolot »

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: How show wxDialog?
« Reply #3 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.