[comp.windows.x.motif] problems with scrolled list widget

dannyd@bwdls47.bnr.ca (Daniel Duguay) (06/10/91)

I'm running Motif 1.1 under HP-UX 7.05.

I've got a scrolled list widget created using XmCreateScrolledList
that I regenerate by doing on XmDeleteAllItems and adding the
new items using XmListAddItem(w, XmString, i+1).

If the list has enough items that  a scrollbar is required, one
appears. If I try to regenerate the list after I've moved the
scrollbar down even slightly, my application goes runaway. If I leave the
scrollbar in its initial position ( the top of the list is seen ), I have
no problems. Has anyone experienced similar problems ?? Here's a look
at my application after a kill -11.

_q_switch+0x218:_XmListAddItem  (0x13E85C, 0x13CCD4, 0x1)
__XtCallSmallCallbacks+0x90:    ???     (0x130CA8, 0xFFEFF375, 0xFFEFE0F0)
_XtCallCallbackList+0x1C:       __XtCallSmallCallbacks  (0x130CA8, 0xFFEFE0C4, 0
xFFEFE0F0)
_XmMessageBoxGetChild+0xD48:    _XtCallCallbackList     (0x130CA8, 0x145A04, 0xF
FEFE0F0)
_XmCreatePushButtonGadget+0x5C: _XmMessageBoxGetChild+0xC8E     ()
_XmMessageBoxGetChild+0x408:    _XmCreatePushButtonGadget+0x28  (0x130CA8, 0xFFE
FE14C, 0x40)
__XmDispatchGadgetInput+0x23E:  ???     (0x130CA8, 0xFFEFE14C, 0x40)
__XmGetActiveTopLevelMenu+0xA48:__XmDispatchGadgetInput (0x130CA8, 0xFFEFEF98, 0
x40)
__XtMatchAtom+0x338:    ???     (0x1307AC, 0xFFEFEF98, 0x0, 0x111DE0)
__XtMatchAtom+0x724:    __XtMatchAtom+0x27C     (0x1307AC, 0xFFEFEF98, 0x12CFC0,
 0x0, 0x12EB5E, 0x111DD8)
__XtTranslateEvent+0x8A:__XtMatchAtom+0x532     ()
_XtWindowToWidget+0x2B4:???     (0x1307AC, 0x1307D8, 0xFFEFEF98, 0xFFEFEB73)
__XtOnGrabList+0x326:   _XtWindowToWidget+0x8E  (0xFFEFEF98, 0x1307AC, 0x8, 0x11
F7DC)
_XtDispatchEvent+0x2A:  __XtOnGrabList+0x90     (0xFFEFEF98)
_XtAppMainLoop+0x1C:    _XtDispatchEvent(0xFFEFEF98)
_XtMainLoop+0x8:_XtAppMainLoop  (0x11E70C)

Any help would be appreciated ..


Danny
dannyd@bnr.ca

sdl@aries.lyra.mitre.org (Steven D. Litvinchouk) (06/12/91)

In article <1991Jun10.151441.25250@bwdls61.bnr.ca> dannyd@bwdls47.bnr.ca (Daniel Duguay) writes:

> I'm running Motif 1.1 under HP-UX 7.05.
> 
> I've got a scrolled list widget created using XmCreateScrolledList
> that I regenerate by doing on XmDeleteAllItems and adding the
> new items using XmListAddItem(w, XmString, i+1).
> 
> If the list has enough items that  a scrollbar is required, one
> appears. If I try to regenerate the list after I've moved the
> scrollbar down even slightly, my application goes runaway. If I leave the
> scrollbar in its initial position ( the top of the list is seen ), I have
> no problems. Has anyone experienced similar problems ?? 

YES!! Lots of people (myself included) have gotten bitten by XmList
bugs, one of which you have described well.  The problem here seems to
occur whenever the list is scrolled so that the items to be deleted
are no longer visible in the visible area.  Obvious workaround: scroll
them back (either manually or under program control) so that they're
visible before you delete them!


--
Steven Litvintchouk
MITRE Corporation
Burlington Road
Bedford, MA  01730
(617)271-7753
ARPA:  sdl@mbunix.mitre.org
UUCP:  ...{att,decvax,genrad,necntc,ll-xn,philabs,utzoo}!linus!sdl
	"Where does he get those wonderful toys?"

julian@sondheim.unx.sas.com (Phil Julian) (06/18/91)

In article <1991Jun10.151441.25250@bwdls61.bnr.ca>, dannyd@bwdls47.bnr.ca (Daniel Duguay) writes:
|> I'm running Motif 1.1 under HP-UX 7.05.
|> 
|> I've got a scrolled list widget created using XmCreateScrolledList
|> that I regenerate by doing on XmDeleteAllItems and adding the
|> new items using XmListAddItem(w, XmString, i+1).
|> 
|> If the list has enough items that  a scrollbar is required, one
|> appears. If I try to regenerate the list after I've moved the
|> scrollbar down even slightly, my application goes runaway. If I leave the
|> scrollbar in its initial position ( the top of the list is seen ), I have
|> no problems. Has anyone experienced similar problems ?? Here's a look
|> at my application after a kill -11.
|> ... ... ...
|> Danny
|> dannyd@bnr.ca

If you just want to update the list selections, then why don't you try setting
the resources.  I have used this to update a list in extended selection mode,
because figuring out what has been updated seems too complex.  I used this code
in a callback routine which copies the selected items from one list to another:


void Copy2_rt_list (w, client_data, call_data)
   Widget     w;
   caddr_t    *client_data;
   XmListCallbackStruct *call_data;
{
  int n;
  Arg args[10];
  n = 0;
  XtSetArg (args[n], XmNitemCount, call_data->selected_item_count); n++;
  XtSetArg (args[n], XmNitems, call_data->selected_items); n++;
  XtSetValues (rt_list, args, n);
}