Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!uunet!mcsun!i2unix!esacs!nick From: nick@esacs.UUCP (Nikolaos Tsivranidis) Newsgroups: comp.windows.x.motif Subject: Re: XmScrolledList explodes Keywords: why it does this Message-ID: <22@esacs.UUCP> Date: 17 Dec 90 15:21:52 GMT References: <1941@beguine.UUCP> Organization: Esa Software s.r.l. Rimini (FO), ITALY Lines: 22 In article <1941@beguine.UUCP>, Paul.Quane@samba.acs.unc.edu (Paul Quane) writes: > In a previous post I asked why my scrolled list went crazy > after a sequence of XmListAddItemUnselected/XmListDeletePos and > use of the scroll bar. Well I tracked it down to the visibleItemCount > resource being corrupted somehow, going from a respectable 5 to an > outrageous 30174, or thereabouts! Anyway in case anybody has the > problem occur in their code the solution is to GetValues the > visibleItemCount before using the above calls and then re-set it later. > Thanks to the person who suggested setting the itemCount to 0 instead > of using the above routines.. I haven't tried this yet but I will. > Hey, not so fast. That "outrageous" 30174 is probably an overwritten piece of memory. I remember tracking down a few problems with XmListDeletePos, especially when you delete the last item on the list. The best advice is to set the itemCount to 0 (if you want to remove everything from the list), and use 1.1 (if you want the list to work correctly). By the way, I believe you would have no problems if you copy the array of items (XmNitems), and put it back with SetValues. - nick -