You may want to use tkwait.window(tt)

If the below is in a function, then tkwait.window(tt) will wait until the 
window goes away (the user clicking on the button) before continuing with the 
code, then you can return the result after that.

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -----Original Message-----
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of RagingJim
> Sent: Sunday, February 14, 2010 9:35 PM
> To: r-help@r-project.org
> Subject: [R] Using text put into a dialog box
> 
> 
> I have written in R this:
> 
> require(tcltk)
> tt<-tktoplevel()
> Name <- tclVar("")
> entry.Name <-tkentry(tt,width="20",textvariable=Name)
> tkgrid(tklabel(tt,text="Please enter site number."))
> tkgrid(entry.Name)
> OnOK <- function()
> 
> {
>       NameVal <- tclvalue(Name)
>       use.this=NameVal
>       tkdestroy(tt)
> }
> 
> OK.but <-tkbutton(tt,text="   OK   ",command=OnOK)
> tkbind(entry.Name, "<Return>",OnOK)
> tkgrid(OK.but)
> tkfocus(tt)
> 
> Fairly simple, yet I am trying to figure out how to save the text that
> the
> user writes into the text box. This data will then be used for a query
> into
> a SQL database. How do I go about using what is written?
> 
> Cheers
> --
> View this message in context: http://n4.nabble.com/Using-text-put-into-
> a-dialog-box-tp1555761p1555761.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to