Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!spool.mu.edu!uwm.edu!bionet!agate!ucbvax!alfalfa.com!nazgul From: nazgul@alfalfa.com (Kee Hinckley) Newsgroups: comp.windows.x.motif Subject: Re: application requested extended selection in XmList in Motif 1.0 Message-ID: <910320154433.548@alphalpha> Date: 20 Mar 91 20:44:33 GMT Article-I.D.: alphalph.910320154433.548 References: <1991Mar19.221635.25488@SanDiego.NCR.COM> Sender: daemon@ucbvax.BERKELEY.EDU Distribution: inet Organization: The Internet Lines: 54 > > 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.