Quantcast

wxMessageDialog - How to set the current active window as the parent window

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

wxMessageDialog - How to set the current active window as the parent window

ds.sundar

Dear All,


         I am trying to set the current window as the parent window of my wxMessageDialog. How do i do this? I have written the following code and in the main, i called MyDialogMethod().

void Messages::MyDialogMethod()
{

 
  wxWindow* topWindow = new wxWindow;
  topWindow = ::wxGetActiveWindow();

  if ( topWindow != NULL )
  {
        wxMessageDialog *dial = new wxMessageDialog(topWindow, wxT("This Mydialog Message"), wxT("Exclamation"), wxOK);
  dial->ShowModal();
  }
  else
  {
        wxMessageDialog *dial1 = new wxMessageDialog(topWindow, wxT("Else part is running"), wxT("Exclamation"), wxOK);
  dial1->ShowModal();
  }
   
}

 but the wxGetActiveWindow() is always returns NULL and only my else part is running.  How do i set my current window as parent window og mydialog? Please help me....

Thanks & Regards
Sundaram. D
Loading...