[R-gui] A GUI question
James Wettenhall
wettenhall at wehi.edu.au
Tue Jul 6 16:29:46 CEST 2004
Hi,
On Tue, 6 Jul 2004, Feng,Yang [Ontario] wrote:
> I am wondering if I can design a window which contains drop down menu,
> error message and output window(text or plot) together.
Yes!
Firstly, some menu discussion. I'm not entirely clear
what you mean by a "drop down menu". I assume you mean
something like a regular pull-down menu ("File", "Edit", "Help"
etc.), rather than a drop-down combo-box (e.g. for selecting a
previously visited URL in a web browser).
There are some basic menu examples
at:
http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/
http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/menus.html
Also, the demos which come with ActiveTcl provide nice examples
of various types of menus and menu-buttons:
http://www.ActiveState.com/Products/ActiveTcl/
See:
demos/Tk/menu.tcl
demos/Tk/menubu.tcl
Whether you should actually install ActiveTcl (rather than just
unzipping the tarball/zip-file and looking at the demos)
depends on your operating system. For Windows, ActiveTcl is
the easiest Tcl/Tk distribution to install, but most Linux
systems come with Tcl/Tk 8.3.x, so installing ActiveTcl 8.4.x
can lead to conflicts. But there's no harm in downloading
it, unzipping it and looking at the demos. (I won't get
into MacOS X issues unless you reveal that to be your OS.)
> I am wondering if I can design a window which contains drop down menu,
> error message and output window(text or plot) together.
A good example of combining input and output on the same window
is the example which comes with tkrplot (from CRAN):
library(tkrplot)
?tkrplot
# Paste the example into your R session.
There is a slider (input) and a graph (output) on the same
window.
> I am wondering if I can design a window which contains drop down menu,
> error message and output window(text or plot) together.
Having an error message on the same window is a bit unusual.
Normally an error message would appear in a message box.
If you want, you can have a text label on your window, which
can be modified dynamically to indicate whether an error has
occurred. See:
http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/textlabels.html
Here are some screenshots of my R-Tcl/Tk applications:
http://bioinf.wehi.edu.au/limmaGUI/about.html
http://bioinf.wehi.edu.au/affylmGUI/about.html
(These use the Tcl/Tk extensions BWidget and Tktable.)
> I read the user menu for TCL/TK, seems it can only provide separate
> window for different purposes.
"user menu" ? I'm not sure what you are referring to here. I
think your assumption about separate windows being required for
separate purposes is incorrect. But of course, it takes a bit
of work to code up a functioning Tcl/Tk window with lots of
"different purposes".
Hope this helps,
James
More information about the R-SIG-GUI
mailing list