arm@sps.com (Annette Myjak) (08/23/90)
I am having problems with items not always appearing in the list for the selection box widget. I need to use the same selection box widget OVER and OVER and OVER -- with a different set of items most of the time. I have an array of structures which contains pointers to "name"s for each of the things in the array. I have a function that processes through this array to create an array of XmStrings of the "name"s, and a variable that keeps track of the number of things in the array. I set XmNlistItems to my array of XmStrings, and set XmNlistItemCount to my counter variable, and manage the selection box widget. Each time time I need the selection box, my application executes the functions to process the array of structures info into an array of XmStrings and sets the appropriate values for the selection box and then manages the widget. Originally, this works just fine: i have 3 things in the array and i see 3 items in my list. NOW: if i add a new thing to my original array, only the first 2 items of the array appear. if i click the mouse in the space where the 3rd item is supposed to be, wa-la, it appears. BUT the new item added to the array, (and supposedly to the item list does not appear). the next time through this process, the first 3 items appear. if i click in the space for a fourth item, the one i added (a long time ago, in a galaxy far, far away . . .) appears! The next time through the selection box, all 4 items appear. This process repeats itself each time i add a new thing to the original array. I know that the information is added into the array. I know that the counter of how many things are in the array is correct. I know that XmNlistVisibleItemCount is greater than the number of things in my list (although I don't understand why is changes from '8' to '7' the second time through after adding a new thing to the array). So why are things that are really there not there, and why are things that got added (and should be there) aren't (until some future time)? (now is everyone as confused as I am???) Any insight would be greatly appreciated. Annette Myjak arm@sps.com
argv@turnpike.Eng.Sun.COM (Dan Heller) (08/23/90)
In article <264@sps.com> arm@sps.com (Annette Myjak) writes: > I am having problems with items not always appearing in the list for the > selection box widget. ... > if i add a new thing to my original array, only the first 2 items of the array > appear. if i click the mouse in the space where the 3rd item is supposed to > be, wa-la, it appears. BUT the new item added to the array, (and supposedly > to the item list does not appear). > > the next time through this process, the first 3 items appear. if i click in > the space for a fourth item, the one i added (a long time ago, in a galaxy > far, far away . . .) appears! It sounds as tho you really have a weird problem. The only reason I am replying to this (no, I don't have a solution) is because I noticed similar odd behavior when I was using my own file search procedure for the file selection dialog. You must remember to set XmNlistUpdated in this procedure. You weren't clear about what kind of list you were dealing with, but I thought I would throw this out as a suggestion. -- dan ---------------------------------------------------- O'Reilly && Associates argv@sun.com / argv@ora.com Opinions expressed reflect those of the author only.
arm@sps.com (Annette Myjak) (08/23/90)
thanks to chuck adams (uunet!shasta.wv.tek.com!adamsc) for his suggestion. chuck admits that it's a hack, but hey, it's a working hack! the answer is to zero out the itemList and then set it to what you really want the new one to be. works like a charm!! (i actually reset itemList to NULL and itemListCount to 0 -- don't know if both are truly necessary.) thanks to netland once again! annette myjak arm@sps.com
carl@quad1.quad.com (Carl Priddy) (08/24/90)
In article <264@sps.com>, arm@sps.com (Annette Myjak) writes: > I am having problems with items not always appearing in the list for the > selection box widget. Annette, As long as folks are just throwing out suggestions, I have a couple: If you are going through the process of managing/unmanaging, it is a short step to destroying/recreating. I don't add or delete items from a selectionbox list, but I recreate them zillions of times with no problem (so far). Also, I had some very bizarre behavior occuring with pulldown menus that was finally traced back to my thoughtlessly re-executing a bit of code that had the "XtAddCallback()" statement in it. Silly me, I thought that the guardian spirit of naive programmers would notice that the function name and callback data were exactly the same, and ignore the additional calls. Boy, was I wrong. This had the effect of queueing the same process to be called many times when I expected it to occur only once! Good luck. carl.