jabir@ivory.SanDiego.NCR.COM (Jabir Hussien) (03/20/91)
Hi all, I was wondering if anybody here could help with a problem I am having doing extended (multiple discontiguous) selection in a XmList widget in Motif 1.0 under R3. The problem is that XmListSelectItem/Pos() automatically deselect previous items and there is no XmListSetAddMode() in 1.0. (I tried cheating by setting the AppendInProgress field from ListP.h to True but that didn't help much...) Anybody have any suggestions how to go about doing this? The only way I can think of is to save the selected items list upon every callback and when I want to (de)select some items, I would need to add/subtract these items from the latest selected items list. Then I would XtSetValues() this new list for the XmNselectedItems resource. In the case of thousands of items, this may get very slow... All help appreciated and thanks in advance... Jabir
nazgul@alfalfa.com (Kee Hinckley) (03/21/91)
> > Hi all, > > I was wondering if anybody here could help with a problem I am > having doing extended (multiple discontiguous) selection in a > XmList widget in Motif 1.0 under R3. > > The problem is that XmListSelectItem/Pos() automatically deselect > previous items and there is no XmListSetAddMode() in 1.0. > (I tried cheating by setting the AppendInProgress field from ListP.h > to True but that didn't help much...) Ignoring the extraneous garbage, this ought to work: void OmXList::select(long pos, Boolean notify) { Arg arg; unsigned char selPol; long i; XtSetArg(arg, XmNselectionPolicy, &selPol); XtGetValues(widget, &arg, 1); if (selPol == XmEXTENDED_SELECT) { XtSetArg(arg, XmNselectionPolicy, XmMULTIPLE_SELECT); XtSetValues(widget, &arg, 1); } else if (selPol != XmMULTIPLE_SELECT) clearSel(); if (pos == OmXListEnd) { for (i = 0; i < datas.size(); ++i) { addSel(i); XmListSelectPos(widget, i+1, False); } } else { XmListSelectPos(widget, pos+1, False); addSel(pos); } if (selPol == XmEXTENDED_SELECT) { XtSetArg(arg, XmNselectionPolicy, selPol); XtSetValues(widget, &arg, 1); } if (notify) selected(selCnt()); } Alfalfa Software, Inc. | Poste: The EMail for Unix nazgul@alfalfa.com | Send Anything... Anywhere 617/646-7703 (voice/fax) | info@alfalfa.com I'm not sure which upsets me more: that people are so unwilling to accept responsibility for their own actions, or that they are so eager to regulate everyone else's.