wolf@cbnewsh.ATT.COM (thomas.wolf) (08/18/89)
I've come across a problem that I don't know what to make of:
I've coded a BulletinBoard widget who has as two of its children ScrollingList
widgets. One of these ScrollingList widgets was populated with a bunch of
list entries. The other list was empty initially. The code looked something
like this:
extern OlListItem item[];
OlListToken (*list1AddItem)(), (*list2AddItem)(), token1, token2;
static Arg query[] = {
{ XtNapplAddItem, (XtArgVal) &list1AddItem }
};
static Arg query2[] = {
{ XtNapplAddItem, (XtArgVal) &list2AddItem }
};
Widget list1, list2;
{
.
.
.
list1 = XtCreateManagedWidget("list1", scrollingListWidgetClass, ...)
list2 = XtCreateManagedWidget("list1", scrollingListWidgetClass, ...)
XtGetValues(list1, query, XtNumber(query));
XtGetValues(list2, query2, XtNumber(query));
for (i=0; i<num_items; i++)
(*applAddItem)(list1, 0, 0, item[i]);
XtAddCallback(list1, XtNuserMakeCurrent, selec_func, NULL);
.
.
.
}
static void selec_func(widget, clientData, callData)
Widget widget;
caddr_t clientData;
caddr_t callData;
{
.
.
.
OlListItem *item;
item = OlListItemPointer((OlListToken) callData);
(*list2AddItem)(list2, 0, 0, *item);
.
.
.
}
Now, for some reason, when list2AddItem in selec_func() gets called, it not
only adds that list item to the end of ScrollingList list2, but it also
appends it to ScrollingList list1 ! Has anyone else experienced this problem?
And if so, can anyone tell me what I'm doing wrong?
Any help would be appreciated,
Tom
P.S. I haven't tried adding an 'XtNapplTouchItem' function -- could that
cause the above behaviour?