Path: utzoo!attcan!uunet!cs.utexas.edu!tut.cis.ohio-state.edu!bloom-beacon!athena.mit.edu!joe From: joe@athena.mit.edu (Joseph C Wang) Newsgroups: comp.windows.x Subject: Reparenting Widgets Message-ID: <12359@bloom-beacon.MIT.EDU> Date: 1 Jul 89 18:33:58 GMT Sender: daemon@bloom-beacon.MIT.EDU Reply-To: joe@athena.mit.edu (Joseph C Wang) Organization: Massachusetts Institute of Technology Lines: 41 I'm helping to develop an application that requires widgets to be reparented. Is there a better way than to do it with the following code? Is anyone thinking about adding an XtReparentWidget call in the next release of X toolkit? Longish code follows. ----------- void XtReparentWidget(widget, new_parent, x, y) Widget widget, new_parent; Position x, y; { if (!XtIsComposite(new_parent)) return; if (XtParent(widget) == new_parent) return; XtUnmanageChild(widget); (*( ((CompositeWidgetClass) XtClass(XtParent(widget)))->composite_class.delete_child)) (widget); widget->core.x = x; widget->core.y = y; widget->core.parent = new_parent; if (XtWindow(new_parent) && XtWindow(widget)) XReparentWindow(XtDisplay(widget), XtWindow(widget), XtWindow(new_parent), (int) x, (int) y); (*( ((CompositeWidgetClass) XtClass(new_parent))->composite_class.insert_child)) (widget); XtManageChild(widget); } -------------------------------- Joseph Wang (joe@athena.mit.edu) 450 Memorial Drive C-111 Cambridge, MA 02139