Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!jarthur!ucivax!orion.oac.uci.edu!ucsd!ucbvax!osf.org!meeks From: meeks@osf.org (W. Scott Meeks) Newsgroups: comp.windows.x.motif Subject: Re: Infinitely-scrollable list widget? Message-ID: <9102211954.AA24646@osf.osf.org> Date: 21 Feb 91 19:54:12 GMT References: <1991Feb20.022721.8463@intek01.uucp> Sender: daemon@ucbvax.BERKELEY.EDU Distribution: inet Organization: The Internet Lines: 35 >From: nwnexus!amc-gw!intek01.UUCP!mark@uunet.uu.net (Mark McWiggins) > >This works OK if I'm willing to set the list up completely in advance, but >it presents problems for scrolling over, say, a database table of 1 million >rows. Ideally I need something that would let me keep a small list, with >a callback procedure to keep refreshing the list "in the background" as >the user uses the mouse to scroll. The ScrollBar widgets contain appropriate >callbacks, but the user can also scroll by dragging down the list itself. >The List widget only contains callbacks that occur after the selection is >made, and that's not soon enough. > >Can anybody point me toward a widget that's designed for this sort of thing, >or some obvious way of doing it with the standard widget set? I have >Motif 1.0 (with X11R3, of course) on an Apollo. Actually, I think you can do this with the existing list widget. Presumably your selectionPolicy is either XmBROWSE_SELECT or XmEXTENDED_SELECT. So if you set automaticSelection to True, you'll get singleSelectionCallback invoked every time the user moves into a new item. One of the pieces of information returned in the callback structure is the position of the item selected. You could compare this with the number of items in the list to determine when you reach the bottom at which point you could suck in the next N records and call XmListAddItems to add them to the end of the list, or you could do some fancier manipulation of XmNitems to keep a constant number of items resident in the list. Of course, the scrollbar is probably going to be going through some weird gyrations as this happens. I hope this helps. Let me know if you get something working or if you have any more questions. W. Scott Meeks | We must live with the fact, true throughout recorded Open Software Foundation | history, that our artifacts are sometimes flawed and meeks@osf.org | cause us to die in novel and unexpected ways, and we (617) 621-7229 | can only do our human best to minimize the problems.