Martin,
I've tweaked your example a bit and attached the outcome to this
message.
With a one line change to List.c, the result of running the test
program is :
dell: {40} list2
Selection (count 1) : 2
Selection (count 1) : 2
Is this what we want ? (This is copying Motif's bug ...)
Note that the change to List.c is as yet incomplete : the widget
highlighting doesn't reflect the selection as printed by the
program.
Danny
On Fri, 2004-08-20 at 19:11, Martin Simmons wrote:
> Look like this could be related to bug # 916711
>
> http://sourceforge.net/tracker/index.php?func=detail&aid=916711&group_id=8596&atid=108596
--
Danny Backx - danny.backx-at-planetinternet.be http://up.to/danny.backx
#include <Xm/Xm.h>
#include <Xm/List.h>
#include <stdio.h>
Widget toplevel, shell, list;
static void PrintSelection()
{
int count, *sel, i;
(void) XmListGetSelectedPos(list, &sel, &count);
fprintf(stderr, "Selection (count %d) :", count);
for (i=0; i<count; i++)
fprintf(stderr, " %d ", sel[i]);
fprintf(stderr, "\n");
XtFree(sel);
}
int
main(int argc, char **argv)
{
Dimension height;
Position y;
XtAppContext app;
XmString items[3];
toplevel = XtVaAppInitialize(&app, "Text", NULL, 0, &argc, argv, NULL, NULL);
XtVaSetValues(toplevel, XmNwidth, 200, XmNheight, 200, NULL);
list = XtVaCreateManagedWidget("one",
xmListWidgetClass,
toplevel,
XmNselectionPolicy, XmSINGLE_SELECT,
NULL);
items[0] = XmStringCreateLocalized("a");
items[1] = XmStringCreateLocalized("b");
items[2] = XmStringCreateLocalized("c");
XtVaSetValues(list, XmNitems, items, XmNitemCount, 3, NULL);
XmListSelectPos(list, 2, False);
PrintSelection();
XtVaSetValues(list, XmNitems, items, XmNitemCount, 3, NULL);
PrintSelection();
XtRealizeWidget(toplevel);
XtAppMainLoop(app);
}