Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!ucsd!ucbvax!suneast.East.Sun.COM!byennaco From: byennaco@suneast.East.Sun.COM (Robert Yennaco - Sun BOS Software) Newsgroups: comp.windows.news Subject: Re: scrolling lists in XView - a file dialog Message-ID: <9006271544.AA01919@divet.East.Sun.COM> Date: 28 Jun 90 00:32:52 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 80 I ran across a similar problem in SunView, so I'll describe it in those terms and leave it to you to convert it to XView. > 1) using xv_set, it is possible to either set a fixed number of > strings for the list, or set an indexed string for the list. > What I need is a variable number of strings. Something like > **argv would have done the trick. > To get a variable number of strings, it is necessary to insert > one entry for each string. This is painfully slow and causes > unnecessary flashing on the screen. Moreover, it is not possible > to start with an empty list of entries --- there must be at least > one or PANEL_LIST_INSERT dumps core. > xv_set(thing, PANEL_LIST_STRINGS, "", (char *) NULL, 0); > xv_set(thing, PANEL_LIST_INSERT, i > PANEL_LIST_STRING, i, newvalue, > 0); You can set up an attribute list, and make one call to panel_set(). The disadvantage here is that (at least in SunView) you're limited to ATTR_STANDARD_SIZE=256 attributes in the list. Needing 3 per value, means you can bundle only 80 or so values into one panel_set() call, keeping in mind that you still need the list NULL-terminator. To get rid of screen flickering, keep the item's PANEL_SHOW_ITEM attribute to FALSE until you've completed list construction, then set the attribute to TRUE. This scheme might not suffice (performance-wise) if you're dealing with a very large list, but it's better than doing each entry one at a time, and the list can be as long as you want. char *attr[ATTR_STANDARD_SIZE]; int num_attr = 0; for (i=0; i= ATTR_STANDARD_SIZE) { attrs[num_attr+3] = NULL; panel_set(thing, ATTR_LIST, attrs, 0); num_attr = 0; } else num_attr += 3; } /* * If any attribute settings still on attribute buffer, * then send them now. */ if (num_attr) { attrs[num_attr] = NULL; panel_set(thing, ATTR_LIST, attrs, 0); } As you state, a better way is to use a string vector argument (**argv) for PANEL_CHOICE_STRINGS. I tried this long ago, and I recall getting it to work (it was lightning-fast!), but now I can't for the life of me figure out how I did it. The disadvantage here (at least in SunView) is that your list cannot exceed ATTR_STANDARD_SIZE=256 string values. > 2) to change the entries, it is not possible to change all of them > at once. I would have hoped something like: > > xv_set(thing, PANEL_LIST_STRINGS, (char *) NULL, 0); > > would have done the trick. Instead it is necessary to delete > them one at a time: > > xv_set(thing, PANEL_DELETE_STRING, i, 0); > > Again, painfully slow and causes unnecessary screen updates. Try the same scheme as described above. Good luck! -Bob