(function() { load("Motif") X = XApplication("none") rc = Widget("bar","XmRowColumn", X,orientation="HORIZONTAL") # rc = Widget("bar","XmRowColumn", X,XResource("orientation", "XmHORIZONTAL")) btn.names <- c("File", "Print", "Find", "Help") btns = vector("list",length(btn.names)) ctr = 1 images = c("redball.gif","slogo2.gif","xterm-sgi.xpm","index.xbm") images = paste("/icons",images,sep="/"); for(i in btn.names) { btns[[ctr]] = Widget(i, "XmPushButton", rc) Callback(Quote(n <- n+1), btns[[ctr]]) Callback(substitute(print(n),list(n=i)), btns[[ctr]]) Callback(expression(print(n)), btns[[ctr]]) # px = Pixmap.file("../Images/arrow.xpm", btns[[ctr]]) px = Pixmap(images[ctr], btns[[ctr]]) if(all(px@dims != 0)) { setResource(btns[[ctr]],XResource("labelType","XmPIXMAP"), XResource("labelPixmap",px) ) } ctr = ctr + 1 } assign("n",1,where=btns[[1]]@frame) XRealize(X) invisible(return(X)) })()