Path: utzoo!utgpu!news-server.csri.toronto.edu!orasis.vis.toronto.edu!tjhorton Newsgroups: comp.windows.x.motif From: tjhorton@vis.toronto.edu ("Timothy J. Horton") Subject: Re: How to re-manage the same child widget Message-ID: <91May16.183920edt.8838@orasis.vis.toronto.edu> Organization: Department of Computer Science, University of Toronto References: <9105132043.AA11128@11128> <91May15.224003edt.8838@orasis.vis.toronto.edu> <1991May16.154512.23319@thyme.jpl.nasa.gov> Distribution: inet Date: 16 May 91 22:39:25 GMT Lines: 40 kaleb@thyme.jpl.nasa.gov (Kaleb Keithley) writes: >tjhorton@vis.toronto.edu ("Timothy J. Horton") writes: >>jerryl@is.Morgan.COM (Jerry Liebelson) writes: >>> QUESTION: Is there an efficient, trouble-free way to unmanage and >>>re-manage one instance of this XmList under different parent container >>>widgets, which themselves might be contained within different shell widgets? >> >>XtReparent (I think that's what it's called -- no books nearby). > >This fits into the category of dis-information. There is no XtReparent(). >And there is no easy, nor clean way to reparent widgets. This is not my >opinion, but an echo of something Schliefer/Gettys/Converse/et. al. have >said in months gone by. I believe you. Sorry, I guess I was confusing it with the Xlib call for reparenting windows (not widgets). XReparent or XReparentWindow or whatever. >One possible solution would be to GetValues() the XmNitems resource from >one and SetValues() it onto the other. Since this is fast and simple, >it's the way I would go. This won't answer Jerry's question; his list is very large and he wants only one instance of the XmList. He'll have several copies because XtSetValues on the XmNitems resource causes a list widget to allocate and make a copy of the entire list. If you no longer need access to the list that you provided to a list widget, you can destroy it, because the list widget has its own private copy. Most motif widgets are like this; they reallocate copies of whatever you give them via pointers. Furthermore, if you fetch back resource values via pointers, most widgets allocate yet another copy of the resource and pass back the new copy, which you normally have to free explicitly. I had an application in which I needed to very quickly swap large lists in and out of a list widget, but couldn't, because the dang list widget always freed its old list and allocated and copied the new one. I had to write my own code from scratch to display selection lists without copying them. [Sorry for the earlier disinformation, and thanks for catching it] Tim