Reparent modal dialog question

Jason Dolan jayson.dolan at gmail.com
Fri Dec 1 13:13:09 PST 2006


Hello,

I have a wxFrame open.  Within that frame I create a modal dialog.  I
then create another wxFrame.  I want to have that other frame own the
modal dialog.

Here is what I'm doing (in pseudo code... my program is actually much
more detailed... but this is the gist of it):

Class MyFrame :: public wxFrame
{
....
...
   CreateModalDialog()
   {
      wxDialog *pDialog = new wxDialog(this,
...,...,wxT("MODAL_DIALOG"));
   }
   AttachModalDialog()
   {

((wxDialog*)FindWindowByName(wxT("MODAL_DIALOG")))->Reparent(this);
   }
}

MyFrame frame1;
frame1.CreateModalDialog();

MyFrame frame 2;
frame2.AttachModalDialog();

-----

But I get this GTK warning:
"Gtk-WARNING **: Can't set a parent on a toplevel widget"
when I call Reparent(the new frame)

But the Reparent() function returns true.

And then afterward whenever I do anything that would create a OnPaint
event on the new frame I get these GTK errors:

"(client:23552): Gtk-CRITICAL **: gtk_widget_size_allocate: assertion
`GTK_IS_WIDGET (widget)' failed

(client:23552): GLib-GObject-WARNING **: invalid uninstantiatable type
`<invalid>' in cast to `GtkObject'

(client:23552): GLib-GObject-CRITICAL **: g_object_get_qdata: assertion
`G_IS_OBJECT (object)' failed

(client:23552): GLib-GObject-CRITICAL **: g_object_get_qdata: assertion
`G_IS_OBJECT (object)' failed

(client:23552): Gtk-CRITICAL **: gtk_widget_size_allocate: assertion
`GTK_IS_WIDGET (widget)' failed"

But other then that... it seems to work.

Is it normal to see these GTK errors?  Or should I not attempt to
reparent a modal dialog?







More information about the wx-users mailing list