Thanks Peter,
I've started a new R session (in Windows) and managed to get
both ways working now :
### THIS WORKS !!! ###
library(tcltk)
tclRequire("IWidgets")
tt<-tktoplevel()
combo <- tkwidget(tt,"iwidgets::combobox")
tkpack(combo)
### AND THIS WORKS TOO !!! ###
tt<-tktoplevel()
win <- .Tk.subwin(tt)
.Tcl(paste("iwidgets::combobox",.Tk.ID(win),.Tcl.args()))
tkpack(win)
But they both fail in my old R session - maybe I've tclRequired
another package or loaded another package which is interfering
or maybe a Tcl object hasn't been cleaned from memory properly.
Thanks very much for your help!
Regards,
James
On 27 Mar 2003, Peter Dalgaard BSA wrote:
> James Wettenhall <wettenhall at wehi.edu.au> writes:
>
> > Hi,
> >
> > I am trying to create a drop-down combobox in R TclTk.
> >
> > The following works fine for a ListBox but fails for a combobox:
> >
> > ################# THIS WORKS FINE - CREATES AN EMPTY LISTBOX ##
> > tt<-tktoplevel()
> > win <- .Tk.subwin(tt)
> > .Tcl(paste("listbox",.Tk.ID(win),.Tcl.args()))
> > tkpack(win)
> >
> > ################## THIS FAILS - ATTEMPTS TO CREATE A COMBOBOX ##
> > tt<-tktoplevel()
> > win <- .Tk.subwin(tt)
> > .Tcl(paste("iwidgets::combobox",.Tk.ID(win),.Tcl.args()))
> > Error in structure(.External("dotTcl", ..., PACKAGE =
"tcltk"),
> > class = "tclObj") :
> > [tcl] .
>
> Hmm, can't see why that shouldn't work. On Linux, this seems to
work fine:
>
> tt<-tktoplevel()
> combo <- tkwidget(tt,"iwidgets::combobox")
> tkpack(combo)
>
> and your code seems to work as well...
>
> You remembered to tclRequire("Iwidgets"), I assume?
>
>
--
--------------------------------------------------------------------------
James Wettenhall Tel: (+61 3) 9345 2629
Division of Genetics and Bioinformatics Fax: (+61 3) 9347 0852
The Walter & Eliza Hall Institute E-mail: wettenhall at wehi.edu.au
of Medical Research, Mobile: (+61 / 0 ) 438 527 921
1G Royal Parade,
Parkville, Vic 3050, Australia
http://www.wehi.edu.au
--------------------------------------------------------------------------