Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!mit-eddie!bloom-beacon!ZIA.AOC.NRAO.EDU!cflatter From: cflatter@ZIA.AOC.NRAO.EDU (Chris Flatters) Newsgroups: comp.windows.x Subject: Re: XView scrolling list usage Message-ID: <9011200021.AA02255@zia.aoc.nrao.edu> Date: 20 Nov 90 00:21:43 GMT Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 66 Mike Strawbridge writes: > I would like to change the all the list's string items by passing to xv_set > one attribute/value pair with a value argument such as a pointer to an array > of pointers to char. Can I do this or do I have to know how many items are > in the list and pass each string in a separate argument? The PANEL_LIST_STRINGS attribute does exactly what you want. Used with xv_create or xv_set it takes a NULL terminated list of strings in an array of char* and sets each item in the scrolling list to the corresponding entry in the array, discarding any previous contents (see pages 155ff in the XView programmers manual). > Also what effect does setting the attribute PANEL_LIST_NROWS supposed > to have? If I have 20 items and set the value to 10, it appears to have > no effect. PANEL_LIST_NROWS is only valid as an argument to xv_get. It returns the current number of rows in the scrolling list. PANEL_LIST_NROWS is updated automatically when you insert or delete items from the list. > I ask these two questions because I would like to use XView scrolling lists > where the contents of the list and the number of items in the list change > often. I would like to dynamically change the string values and the number > of items in the list. Are scrolling lists intended for this use or are they > really meant to be rather static ... that is, initialized once and used > with those values only. Scrolling lists are intended to be dynamic: " - Use an exclusive scrolling list in lieu of an exclusive setting when there are too many choices to fit in the available space, when the number of choices varies as the application runs, or when you want users to be able to edit the list." OPEN LOOK GUI Application Style Guidelines, p217 " - Use a nonexclusive scrolling list in place of non-exclusive settings when the number of choices is very large or varies dynamically." ibid, p217 " - Do not use menus for situations in which the number of items is not fixed and can grow extremely large. Use a scrollable region --- either a pane or a scrolling list --- instead. - Use a scrolling region instead of a menu when users can edit the list of items." ibid, p142 And so on. The style guide contains a lot of good advice on where (and where not) to use each particular OPEN LOOK UI element. I would rate it as an essential reference if you are programming using any OPEN LOOK toolkit. Both the style guide and the XView programming manual come with OpenWindows. If you just pulled XView off the net the publication details are: OPEN LOOK Graphical User Interface Application Style Guidelines, by Sun Microsystems, Inc., Addison-Wesley Publishing Company, Inc, 1990 ISBN 0-201-52364-7, $24.95 XView Programming Manual (2nd Edn.), by Dan Heller, O'Reilly & Associates, Inc., 1990 ISBN 0-937175-52-8, (no price marked on cover). Chris Flatters