Path: utzoo!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!hplabs!hpfcdc!hpfclp!diamant From: diamant@hpfclp.SDE.HP.COM (John Diamant) Newsgroups: comp.windows.x Subject: Re: Re: XtReparentWidget (How about XtCopyWidget) Message-ID: <9740089@hpfclp.SDE.HP.COM> Date: 10 Apr 89 00:35:41 GMT References: <9941@polyslo.CalPoly.EDU> Organization: HP SESD, Fort Collins, CO Lines: 32 > >The Toolkit does contain enough information. The size of a widget w can > >be obtained as follows: > > > > XtClass(w)->core_class.widget_size; > > > >With that, you can malloc up a suitable sized chunk of memory and do a raw > >memory copy using bcopy to the new location. > > On the contrary, this is not general at all. What if the widget has > non-core part data? I don't see how this has anything to do with it. The widget_size is filled in with the size of the entire widget record, not the size of the CorePart, so it will copy all data in the widget. > Also, if such a widget could be created you'd need > a mechanism to inform the parent that a child has been created behind > it's back. Well, yes. It is not general in that sense. In fact, someone else pointed out via mail that this will cause trouble if there are pointers in the structure as both widgets would write to common data. That's true, but I was only attempting to answer a question in the original note which said that the original would be destroyed after the copy was made, so it shouldn't have mattered much. I never understood how this was supposed to solve the reparenting problem. It appears to me that it does not. John Diamant Software Engineering Systems Division Hewlett-Packard Co. ARPA Internet: diamant@hpfclp.sde.hp.com Fort Collins, CO UUCP: {hplabs,hpfcla}!hpfclp!diamant