[R] tcltk again

Richard Müller
Sat, 29 Dec 2007 17:17:42 -0000

Hello,
the admonition of Prof. Ripley to search the documentation to solve my problem
helped, today I read a lot more on Tcl/Tk than before ;-)
But now I'm stuck again. With the help of my script some functions are
plotted
on the display, then I ask if the user wants to save it as pdf. In windows I
use winDialog and it works. But I can't succeed in Linux. In short:
----------------------------------------------------
X11()
...
res <-    tkmessageBox(title="Beenden?",
      message="Vor dem Beenden als PDF speichern?",
      icon="question", type="okcancel")
if (tclvalue(res) == "ok")
...
-----------------------------------------------------
So far every thing is OK. Now I want a box the user should fill in the choosen
filename (with a default)
and then
--------------------
pdf(filename)
...
--------------------
I experimented with tkgetSaveFile(). But in the moment the user gives the
filename the file is not yet generated! And I can't generate it in advance,
because the filename is not yet specified.
So I looked for a dialog box. [Some boxes are called "dialog boxes"
though
they only talk _to_ the user (besides the user's "yes" or
"no")]. Just a
simple box with a text field the user can type in and the value of this field
given back.
One option was the "modal dialog", but I was not able to pick the
essentials
out of it. I did not want to press several buttons until the necessary window
appears. Also the "editable text window" was not really a solution.
Perhaps a small hint again?