# # 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, propogate=T) rc = Widget("rc", "XmRowColumn", form, propogate=T) setResource(rc, orientation="XmHORIZONTAL", leftAttachment="XmATTACH_FORM", rightAttachment= "XmATTACH_FORM", topAttachment= "XmATTACH_FORM" ) btn1 = Widget("Set", "XmPushButton", rc, propogate=T) btn2 = Widget("Get", "XmPushButton", rc, propogate=T) # Callback(Quote(print(getResource(list.widget,itemCount=integer(1),XResource("items",list())))), btn2) #Callback(Quote(print(getResource(list.widget,XResource("height",integer(1)),itemCount=integer(1)))), btn2) # Callback(Quote(if(!exists("error.dialog")) error.dialog = ErrorDialog(callback.widget, callback.event) else XManage(error.dialog)),btn1) assign("n", 0, where=btn1@frame) Callback(Quote({n <- n + 1;print(n)}),btn1) expr =substitute({assign("n", n + 1,where=fr)},list(fr=X@frame)) Callback(expr,btn1,"activate") btn3 = Widget("Quit", "XmPushButton", rc) Callback(substitute(Xit(get("XApp",frame=frame)), frame=list(frame=X@frame)), btn3, frame = 1) # img = Pixmap("Pixmaps/xmosaic.xbm", widget=btn3) # img = Pixmap("Pixmaps/dog.xpm", widget=btn3) img = Pixmap("/icons/redball.gif", w=X@widget) setResource(btn3, labelType = "XmPIXMAP", labelPixmap=img) l = Widget("list","XmScrolledList",form, realize=T, propogate=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" ) invisible(return(list(list=l, app=X))) })()