[comp.windows.x.motif] Delete and rebuild items of XmList

amc@wlv.imsd.contel.com (Allen M. Cohen) (01/03/91)

What is the fastest way to delete all items in a list widget and replace them
with an entirely new set of items?  (I am using Motif 1.0 under ISC unix 2.2).
Currently, I'm doing:
    1)  XmListDeletePos  in a loop to delete all the items.
    2)  XmListAddItemUnseleted  to put the new items in.

The latter is incredibly slowwwwww.
<> Allen M. Cohen                  Internet:  amc@wlv.imsd.contel.com       <>
<> 3041 E. Black Hills Ct.         UUCP:      elroy.Jpl.Nasa.Gov!agi0!allen <>
<> Westlake Village, Ca. 91362     Telephone: (805) 498-9611 ext. 195       <>
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>

kaleb@thyme.jpl.nasa.gov (Kaleb Keithley) (01/03/91)

In article <1991Jan2.183113.2111@wlbr.imsd.contel.com> amc@wlv.imsd.contel.com (Allen M. Cohen) writes:
>
>What is the fastest way to delete all items in a list widget and replace them
>with an entirely new set of items?  (I am using Motif 1.0 under ISC unix 2.2).
>Currently, I'm doing:
>    1)  XmListDeletePos  in a loop to delete all the items.
>    2)  XmListAddItemUnseleted  to put the new items in.
>

1. Unmanage the list first.  Not necessary if you do 2 and 3 below.

2. There is an undocumented function XmListDeleteAllItems(lw); well, it's
undocumented in 1.1 if you still have the 1.0 docs.  It may be there in 1.0.
I don't know.

3. Build your own item list and set it and itemCount with XtSetValues.

-- 
Kaleb Keithley                      Jet Propulsion Labs
kaleb@thyme.jpl.nasa.gov

Offensive quote coming soon to a .signature file near you.

tbray@watsol.waterloo.edu (Tim Bray) (01/05/91)

amc@wlv.imsd.contel.com (Allen M. Cohen) writes:
 What is the fastest way to delete all items in a list widget and replace them
 with an entirely new set of items?

I just do an XtSetArg of XmNitems and XmNitemCount, then XtSetValues on
the widget.  There is really no perceptible delay.  Is this wrong?

Tim Bray

nazgul@alfalfa.com (Kee Hinckley) (01/09/91)

> Personally, I think the Motif Programmer's Guide is the most useless
> excuse for a manual I've seen from OSF.  When I first started using
...
> but nothing about what's really going on).  OSF must have the worst tech
> writers in the business. 

In all fairness, the OSF techwriters didn't write it, they're
just stuck with the task of trying to rewrite it (offhand
I'd recommend starting from scratch).

						-kee