[comp.windows.x.motif] Infinitely-scrollable list widget?

cjmchale@cs.tcd.ie (Ciaran McHale) (02/21/91)

In <1991Feb20.022721.8463@intek01.uucp>
mark@intek01.uucp (Mark McWiggins) writes:

>I'm building a Motif interface to our in-house database system.  Part of
>the interface is a browser for the database tables.  I'm currently using
>a List widget with a ScrolledWindow parent.
>
>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.

The maximum size of a X window is 2**16 -1 pixels high/wide.
So it is impossible to have a container widget/window which
holds ~1 million other windows/widgets. Windows just can't
be that large. You can, of course, code around this but
beware that many container widgets won't be able to cope.
Also, if you plan on having a separate window/widgets for
each row then that's 1 million windows/widgets! The X server
may well run out of memory (if your client doesn't first).

>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. 

I don't know of any widget that does exactly what you want.
(But then I don't use Motif; maybe it has a suitable one.)
If you can't find a suitable widget then you could always
write your own. (There are several books available,
including Doug Young's one, which discuss widget writing.)


Ciaran.
-- 
Ciaran McHale		"Verbosity says it all"			      ____
Department of Computer Science, Trinity College, Dublin 2, Ireland.   \  /
Telephone: +353-1-772941 ext 1538	FAX: +353-1-772204	       \/
Telex: 93782 TCD EI			email: cjmchale@cs.tcd.ie

meeks@osf.org (W. Scott Meeks) (02/22/91)

>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.

emuleomo@paul.rutgers.edu (Emuleomo) (02/22/91)

This is an interesting idea.  Pls post any replies!

-Olu
-- 
Remember! It doesn't matter if you win or lose, as long as you win!