Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!rpi!dali.cs.montana.edu!uakari.primate.wisc.edu!sdd.hp.com!hplabs!hplabsz!mayer From: mayer@hplabsz.HPL.HP.COM (Niels Mayer) Newsgroups: comp.windows.x.motif Subject: Re: switching lists Message-ID: <5736@hplabsz.HPL.HP.COM> Date: 6 Aug 90 23:30:19 GMT References: Reply-To: mayer@hplabs.hp.com (Niels Mayer) Organization: Hewlett-Packard Labs, Software & Systems Lab, Palo Alto, CA. Lines: 30 Summary: Expires: Sender: Followup-To: In article mitch@edsvcs.osf.org (Mitch Trachtenberg) writes: >>I have an application which wishes to switch the contents of a list >>upon demand... > >I don't have Motif in front of me, so I wouldn't want to swear to this, >but I think you can just set a new array of compound strings into the >list's "items" resource. You may or may not then need to manually adjust >"itemCount". If memory serves, there are examples of this in source >to the mre demo (grep "items"). In my experience, you do have to adjust the XmNitemcount resource, unless your program is designed to core-dump when you have the itemcount set larger than the # of items in the list. What if... the itemList resource were null terminated??? Then you could throw out the itemcount resource, you could prevent J.Random.User from causing a program to core-dump by setting the XmNitems resource but getting XmNitemCount wrong. You could write resource editors that wouln't need special cases for every XmRXmStringTable resource to figure out its associated itemcount resource, and finally, you could get rid of memory leaks caused by calling XtConvert(XmRString-->XmRXmStringTable) (which calls _XmCvtStringToXmStringTable())... Naah. Leave it as is. Design flaws such as non null terminated XmNitems and the "hidden XmScrolledWindowWidgetClass parents of XmList and XmText" (which undoubtedly is the cause of PJS's XmList problems) are the sorts of things that make Motif the greatest adventure game in all of computerdom, while offering good job security for those that program with it. -- Niels "XYZZY" Mayer.