# # Note the different styles for setting # the resources! # either an XResource or alternatively a # resource = val # (i.e. a named argument) # pair. (function() { load("Motif") X = XApplication("list") form = Widget("form", "XmForm", X@widget) rc = Widget("rc", "XmRowColumn", form) setResource(rc, orientation="XmHORIZONTAL", leftAttachment="XmATTACH_FORM", rightAttachment= "XmATTACH_FORM", topAttachment= "XmATTACH_FORM" ) btn1 = Widget("Set", "XmPushButton", rc) btn2 = Widget("Get", "XmPushButton", rc) assign("n", 0, where=btn1@frame) btn3 = Widget("Quit", "XmPushButton", rc) Callback(substitute(Xit(get("XApp",where=frame)), frame=list(frame=X@frame)), btn3, frame = 1) # img = Pixmap("Pixmaps/xmosaic.xbm", widget=btn3) # img = Pixmap("Pixmaps/dog.xpm", widget=btn3) image.name = "/icons/orangeball.gif" img = Pixmap(image.name, w=X@widget) setResource(btn3, labelType = "XmPIXMAP", labelPixmap=img) l = Widget("list","XmScrolledList",form, realize=T) assign("list.widget",l,where = l@frame) setResource( XParent(l), XResource("leftAttachment", "XmATTACH_FORM"), XResource("rightAttachment", "XmATTACH_FORM"), XResource("bottomAttachment", "XmATTACH_FORM"), topAttachment = "XmATTACH_WIDGET", XResource("topWidget", rc) ) XRealize(X) objs = objects() res.count = XResource("itemCount", length(objs)) setResource(l,items = objs, itemCount= as(length(objs),"integer"), selectionPolicy = "XmMULTIPLE_SELECT" ) cat("Items resource:\n") # print(unlist(getResourceList(l),recursive=F)) l@set = WidgetSet("Motif") print(getResource(l, items=list(),"itemCount")) print(getResource(btn1, "labelString", height=list())) print(img@value) print(getResource(btn3, "labelPixmap")) # tmp = getResource(btn1, labelString=list())[[1]] invisible(return(l)) })()