Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!sdd.hp.com!hplabs!nsc!pyramid!athertn!thanh From: thanh@athertn.Atherton.COM (Thanh Diec) Newsgroups: comp.windows.x,ba.windows.x Subject: help with XmCreateScrolledList Message-ID: <35570@olive.athertn.Atherton.COM> Date: 25 Jun 91 03:16:16 GMT Reply-To: thanh@olive.Atherton.COM (Thanh Diec) Followup-To: comp.windows.x Distribution: usa Organization: Atherton Technology, Sunnyvale, CA Lines: 93 Does anyone out there have a working example of XmCreateScrolledList()? I have a procedure here to display a list in a scrolling window, but the window displayed is empty, without scrollbars or list. Can anyone tell me what is wrong with this procedure? Whereas if I use the 'list' widget, the list is displayed. Thanks in advance, Thanh thanh@atherton.com (408)734-9822 ==================== program ==================== #include #include #include #include #include #include #include #include #include static Widget showList(); main(argc, argv) int argc; char *argv[]; { XtAppContext app_context; Widget topLevel, root, cmd, add, quit, mlist; int addDesc, quitDesc; topLevel = XtVaAppInitialize( &app_context, "XAtdbux", NULL, 0, &argc, argv, NULL, NULL); showList(topLevel); XtRealizeWidget (topLevel); XtAppMainLoop(app_context); } static char *names[] = { "one", "two", "three" }; static Widget showList(parent) Widget parent; { XmString *xmstr; Widget bb, mlist; Arg wargs[10]; int idx, n, namesCnt; /* base window */ bb = XtCreateManagedWidget("bb", xmBulletinBoardWidgetClass, parent, NULL, 0); /* str -> xmstr */ namesCnt = XtNumber(names); xmstr = (XmString *) XtMalloc(sizeof(XmString) * namesCnt); for (idx = 0; idx < namesCnt; idx++) xmstr[idx] = XmStringCreate(names[idx], XmSTRING_DEFAULT_CHARSET); n = 0; XtSetArg(wargs[n], XmNitems, xmstr); n++; XtSetArg(wargs[n], XmNitemCount, namesCnt); n++; XtSetArg(wargs[n], XmNvisibleItemCount, namesCnt); n++; XtSetArg(wargs[n], XmNscrollingPolicy, XmAUTOMATIC); n++; #if SCROLLED_LIST /* scrolled list, does NOT work, blank window */ mlist = XmCreateScrolledList(bb, "mlist", wargs, n); #else /* list, works */ mlist = XtCreateManagedWidget("mlist", xmListWidgetClass, bb, wargs, n); #endif return(mlist); }