[comp.windows.x.motif] switching lists

mitch@edsvcs.osf.org (Mitch Trachtenberg) (08/07/90)

>I have an application which wishes to switch the contents of a list
>upon demand...

I don't have Motif in front of me, so I wouldn't want to swear to this,
but I think you can just set a new array of compound strings into the
list's "items" resource.  You may or may not then need to manually adjust
"itemCount".  If memory serves, there are examples of this in source
to the mre demo (grep "items").

--
Mitch Trachtenberg, OSF  (mitch@osf.org) (617) 621-8895

mayer@hplabsz.HPL.HP.COM (Niels Mayer) (08/07/90)

In article <MITCH.90Aug6142819@edsvcs.osf.org> mitch@edsvcs.osf.org (Mitch Trachtenberg) writes:
>>I have an application which wishes to switch the contents of a list
>>upon demand...
>
>I don't have Motif in front of me, so I wouldn't want to swear to this,
>but I think you can just set a new array of compound strings into the
>list's "items" resource.  You may or may not then need to manually adjust
>"itemCount".  If memory serves, there are examples of this in source
>to the mre demo (grep "items").

In my experience, you do have to adjust the XmNitemcount resource, unless
your program is designed to core-dump when you have the itemcount set
larger than the # of items in the list.

What if... the itemList resource were null terminated??? Then you could
throw out the itemcount resource, you could prevent J.Random.User from
causing a program to core-dump by setting the XmNitems resource but getting
XmNitemCount wrong. You could write resource editors that wouln't need
special cases for every XmRXmStringTable resource to figure out its
associated itemcount resource, and finally, you could get rid of memory
leaks caused by calling XtConvert(XmRString-->XmRXmStringTable) (which
calls _XmCvtStringToXmStringTable())...

Naah. Leave it as is. Design flaws such as non null terminated XmNitems and
the "hidden XmScrolledWindowWidgetClass parents of XmList and XmText"
(which undoubtedly is the cause of PJS's XmList problems) are the sorts of
things that make Motif the greatest adventure game in all of computerdom,
while offering good job security for those that program with it.

-- Niels "XYZZY" Mayer.

randy@erik.UUCP (Randy Brown) (08/10/90)

>From uunet!alphalpha.com!motif-request Fri Aug 10 01:00:06 1990
Received: by uunet.uu.net (5.61/1.14) with UUCP 
	id AA14841; Fri, 10 Aug 90 00:42:53 -0400
Received: by alphalpha.com ( 5.52 (84)/test)
	id AA02659; Wed, 8 Aug 90 02:52:38 EDT
Received: by alphalpha.com ( 5.52 (84)/test)
	id AA02656; Wed, 8 Aug 90 02:52:35 EDT
Received: by alphalpha.com ( 5.52 (84)/test)
	id AA01326; Wed, 8 Aug 90 02:26:05 EDT
Received: from RUTGERS.EDU by BU.EDU (1.98) Tue, 7 Aug 90 20:25:24 EDT
Received: from bcm.UUCP by rutgers.edu (5.59/SMI4.0/RU1.3/3.07) with UUCP 
	id AA09500; Tue, 7 Aug 90 20:01:39 EDT
Message-Id: <9008080001.AA09500@rutgers.edu>
Received: from nuchat by bcm.uucp id aa28564; 7 Aug 90 19:27 EDT
From: uunet!moray.sccsi.com!texhrc!uucpnews
Date: Tue,  7 Aug 90 18:02:33 GMT
Apparently-To: comp-windows-x-motif
Status: RO

>From nuchat!texhrc!uucpnews
Received: from moray.UUCP by shell.com SHELL-X1.3 id AA11566; Tue, 7 Aug 90 17:49:10 -0500
Received: by moray.sccsi.com (smail2.5)
	id AA20358; 7 Aug 90 18:50:39 EDT (Tue)
Received: by nuchat.UUCP (smail2.5)
	id AA17639; 7 Aug 90 16:34:27 CDT (Tue)
Received: by texhrc.UUCP (5.61/4.8)
	id AA09844; Tue, 7 Aug 90 11:47:40 -0500
To: nuchat!ntess1!tness7!bellcore!rutgers!comp-windows-x-motif
>Naah. Leave it as is. Design flaws such as non null terminated XmNitems and

I'm as ready to complain about Motif (sure, even Xt) design as anyone,
but surely someone who uses LISP all the time shouldn't complain about
aspects of the design meant to help languages other than C.  I believe
that this kind of stuff is to help with interfaces to Fortran, which
doesn't have pointers or address functions, making it hard to say "until
the address is NULL, do...".  I think you've just been passing the "n"
argument in XtSetValues, XtGetValues, and a million others for so long
that you've forgotten about it.  I don't like it either, but the whole
idea of doing object-oriented programming in PDP macro assembler is
deranged anyway :-) though I certainly am thankful to those who made it
work and am not willing to spill my blood in a vain attempt to get the
world to agree on any of the perhaps technically superior but certainly
narrowly accepted alternatives.

>the "hidden XmScrolledWindowWidgetClass parents of XmList and XmText"

Amen. Amen. Amen. ... rb