xev@harvey.gte.com (Xev Gittler) (10/09/90)
Is there a way to get the positions of selected items in the Motif List widget, without using callbacks? My application wants to use many buttons to do different things to the selected item. Therefore, when the button is activated, I pass the callback the list widget. With the widget, is there anyway to retrieve the position of the selected items? -- Xev Gittler xev@bunny.gte.com
bazavan@hpcilzb.HP.COM (Valentin Bazavan) (10/10/90)
There is no direct way, but it is possible. First, you have to retrieve XmNselectedItems, XmNselectedItemCount, XmNitems and XmNitemCount resources using XtGetValues. Then you take each item in the XmNselectedItems list and compare it against the XmNitems list using XmStringCompare. When a match occurs, the list position is the index of the matched item in the XmNitems list plus one. Valentin Bazavan vbazavan@hpdtc.hp.com
meeks@osf.org (W. Scott Meeks) (10/11/90)
>From: hpcc05!hpcuhb!hpcilzb!bazavan@hplabs.hpl.hp.com (Valentin Bazavan) > >There is no direct way, but it is possible. First, you have to retrieve >XmNselectedItems, XmNselectedItemCount, XmNitems and XmNitemCount resources >using XtGetValues. Then you take each item in the XmNselectedItems list >and compare it against the XmNitems list using XmStringCompare. When a match >occurs, the list position is the index of the matched item in the XmNitems >list plus one. > >Valentin Bazavan >vbazavan@hpdtc.hp.com > In 1.0 its true that this was really the only way to get the positions of the selected items. In 1.1 there is a new function, XmListGetSelectedPos, which takes a widget and returns an array of positions corresponding to the selected items in the list. See the man pages for more details. W. Scott Meeks Open Software Foundation meeks@osf.org (617) 621-7229