Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!lll-winken!sun-barr!newstop!sun!argv From: argv@turnpike.Eng.Sun.COM (Dan Heller) Newsgroups: comp.windows.x.motif Subject: Re: Motif List boxes Message-ID: <140923@sun.Eng.Sun.COM> Date: 18 Aug 90 07:56:41 GMT References: <2304@kiwi.mpr.ca> Sender: news@sun.Eng.Sun.COM Organization: O'Reilly && Associates Lines: 48 In article <2304@kiwi.mpr.ca> jaccard@dssmv2.UUCP (Philippe Jaccard) writes: > As the number of Items is highly variable, I need to allocate/deallocate > memory each time a Initialize the list contents. What I do (for the time being) is maintain the list (never deallocate it) and whenever I need to reset the list, I change the appropriate items and set-values to the same list. Basically, I keep a copy of the list all the time. The reason this is necessary is hopefully a temporary one. That is, there is no way to *change* elements in the list -- you must delete and add items to have the same type of effect (and the visual feedback of such activity is embarrassing). Also, you can't get-values the XmNitems-change an item-reset the list because the internal list doesn't think it's changed anything so nothing gets redrawn. On the other hand, > Does anybody know what does MOTIF do with this array of XmSrring ? One of the great mysteries of life. (Hint: someone reply to this) > Does the XmList object make an internal copy ? Yes -- apparently Motif makes good attempts to make internal copies of most things except for pixmaps. That is, if you set an icon label to be a pixmap, don't free it as it is used during the life of the widget that's using it. > How do the XmListAddItem and XmListDeleteItem access the list ? There's nothing magical about that -- it doesn't do anything more complicated than playing with lists and arrays. > Is XmListDeleteItem the only way to Free the memory space allocated for > the items ? As far as I've seen. There are a great number of aspects to the List widget that would be -great- to have access to from the programmer's perspective. I don't know why they didn't choose to have public resources available to access these items. Internally, they provide everything you'd ever need to manipulate the list efficiently, but none of these functions or variables are available outside the package. I tried to bring this up last time, but no one answered. Perhaps someone from OSF would be kind enough to indicate that one of the following is true: 1) nothing has changed -- don't expect anything more. 2) we've added lots of stuff! Life will be much better. 3) we've made changes, but it's debatable whether you'll be happy with them -- dan ---------------------------------------------------- O'Reilly && Associates argv@sun.com / argv@ora.com Opinions expressed reflect those of the author only.