[R-gui] MainFrame Tk BWidget

Enrique Bengoechea enrique.bengoechea at credit-suisse.com
Tue Apr 20 16:41:24 CEST 2004


Thanks for your answer, I'll try to transform the example below to character vector, although any additional clue will be acknowledged  :-)

>From the documentation:

-menu (read-only)

This option describes the menu. This is a list whose each five elements describe one cascade menu. It has the following form: {menuname tags menuId tearoff menuentries...} where menuentries is a list where each element describe one menu entry, which can
be:
      * for a separator: {separator}
      * for a command: {command menuname ?tags? ?description? ?accelerator? ?option value? ...}
      * for a check button: {checkbutton menuname ?tags? ?description? ?accelerator? ?option value? ...}
      * for a radio button: {radiobutton menuname ?tags? ?description? ?accelerator ?option value? ...}
      * for a cascade menu: {cascade menuname tags menuId tearoff menuentries}

Example:

set descmenu {
    "&File" {} {} 0 {
        {command "&New"     {} "Create a new document"     {Ctrl n} -command Menu::new}
        {command "&Open..." {} "Open an existing document" {Ctrl o} -command Menu::open}
        {command "&Save"    open "Save the document" {Ctrl s} -command Menu::save}
        {cascade  "&Export"  {} export 0 {
            {command "Format &1" open "Export document to format 1" {} -command {Menu::export 1}}
            {command "Format &2" open "Export document to format 2" {} -command {Menu::export 2}}
        }}
        {separator}
        {cascade "&Recent files" {} recent 0 {}}
        {separator}
        {command "E&xit" {} "Exit the application" {} -command Menu::exit}
    }
    "&Options" {} {} 0 {
        {checkbutton "Toolbar" {} "Show/hide toolbar" {}
            -variable Menu::_drawtoolbar
            -command  {$Menu::_mainframe showtoolbar toolbar $Menu::_drawtoolbar}
        }
    }
}



which looks likes a list of lists, as menuentries seem to be nested...


___________________________________________________________________________

Enrique Bengoechea
Investment Consulting - CREDIT SUISSE Spain
___________________________________________________________________________






Peter Dalgaard <p.dalgaard at biostat.ku.dk> on 20/04/2004 13:25:49

To:    Enrique Bengoechea/CSPF at PCOMINT
cc:    r-sig-gui at stat.math.ethz.ch

Subject:    Re: [R-gui] MainFrame Tk BWidget

Enrique Bengoechea <enrique.bengoechea at credit-suisse.com> writes:

> Hi,
>
> I'm started building a Tk GUI for a R-based app, and I've
> successfully build an initial prototype.
>
> Nevertheless, I'm now trying to use the MainFrame BWidget
> distributed with ActiveTcl 8.4.6, and I don't know how can I set its
> menu option. This option expects a list whose each five elements
> describe one cascade menu. Could someone point to me how can I pass
> a list? I haven't found anything similar in the docs nor the useful
> examples compiled by James Wettenhall.
>
> Any help welcomed. Sorry if this is easy, these are my first trials
> with Tk and R.

Do you have an example of how this works in Tcl? Usually, a list can
be passed as a character vector from R.


--
   O__  ---- Peter Dalgaard             Blegdamsvej 3
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907



More information about the R-SIG-GUI mailing list