\HeaderA{tk2widgets}{A themed series of tk widget}{tk2widgets}
\aliasA{tk2button}{tk2widgets}{tk2button}
\aliasA{tk2canvas}{tk2widgets}{tk2canvas}
\aliasA{tk2checkbutton}{tk2widgets}{tk2checkbutton}
\aliasA{tk2combobox}{tk2widgets}{tk2combobox}
\aliasA{tk2entry}{tk2widgets}{tk2entry}
\aliasA{tk2frame}{tk2widgets}{tk2frame}
\aliasA{tk2label}{tk2widgets}{tk2label}
\aliasA{tk2labelframe}{tk2widgets}{tk2labelframe}
\aliasA{tk2listbox}{tk2widgets}{tk2listbox}
\aliasA{tk2mclistbox}{tk2widgets}{tk2mclistbox}
\aliasA{tk2menu}{tk2widgets}{tk2menu}
\aliasA{tk2menubutton}{tk2widgets}{tk2menubutton}
\aliasA{tk2message}{tk2widgets}{tk2message}
\aliasA{tk2notebook}{tk2widgets}{tk2notebook}
\aliasA{tk2panedwindow}{tk2widgets}{tk2panedwindow}
\aliasA{tk2progress}{tk2widgets}{tk2progress}
\aliasA{tk2radiobutton}{tk2widgets}{tk2radiobutton}
\aliasA{tk2scale}{tk2widgets}{tk2scale}
\aliasA{tk2scrollbar}{tk2widgets}{tk2scrollbar}
\aliasA{tk2separator}{tk2widgets}{tk2separator}
\aliasA{tk2spinbox}{tk2widgets}{tk2spinbox}
\aliasA{tk2table}{tk2widgets}{tk2table}
\aliasA{tk2text}{tk2widgets}{tk2text}
\aliasA{tk2tree}{tk2widgets}{tk2tree}
\aliasA{tk2treeview}{tk2widgets}{tk2treeview}
\keyword{utilities}{tk2widgets}
\begin{Description}\relax
A series of widgets you can use in your tk windows/dialog boxes.
\end{Description}
\begin{Usage}
\begin{verbatim}
  tk2button(parent, ...)
  tk2canvas(parent, ...)
  tk2checkbutton(parent, ...)
  tk2combobox(parent, ...)
  tk2entry(parent, ...)
  tk2frame(parent, ...)
  tk2label(parent, ...)
  tk2labelframe(parent, ...)
  tk2listbox(parent, ...)
  tk2mclistbox(parent, ...)
  tk2menu(parent, ...)
  tk2menubutton(parent, ...)
  tk2message(parent, ...)
  tk2notebook(parent, ...)
  tk2panedwindow(parent, ...)
  tk2progress(parent, ...)
  tk2radiobutton(parent, ...)
  tk2scale(parent, ...)
  tk2scrollbar(parent, ...)
  tk2separator(parent, ...)
  tk2spinbox(parent, ...)
  tk2table(parent, ...)
  tk2text(parent, ...)
  tk2tree(parent, ...)
  tk2treeview(parent, ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{parent}] The parent window 
\item[\code{...}] Further arguments passed to the widget 
\end{ldescription}
\end{Arguments}
\begin{Value}
The reference to the created widget.
\end{Value}
\begin{Note}\relax
Most of these widgets comes from the tile (currently 0.4) library
\end{Note}
\begin{Author}\relax
Philippe Grosjean
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{tk2theme}{tk2theme}}, \code{\LinkA{tk2tip}{tk2tip}}, \code{\LinkA{tk2commands}{tk2commands}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
  ## Not run: 
    ## These cannot be run by examples() but should be OK when pasted
    ## into an interactive R session with the tcltk package loaded

        ### A tk2notebook example
    tt2 <- tktoplevel()
    nb <- tk2notebook(tt2)
    tcli1 <- tk2label(nb, text = "Nothing here.")
    tkadd(nb, tcli1, text = "Test")
    tcli2 <- tk2frame(nb)
    but <- tk2button(tcli2, text = "Click me", command = function() tkdestroy(tt2))
    tkgrid(but)
    tkadd(nb, tcli2, text = "Button")
    tkselect(nb, tcli2)
    tkgrid(nb)

    ## A simple tk2panedwindow example
    tt2 <- tktoplevel()
    pw <- tk2panedwindow(tt2, orient = "vertical")
    lpw.1 <- tk2label(pw, text = "Panel 1")
    lpw.2 <- tk2label(pw, text = "Panel2")
    tkadd(pw, lpw.1, minsize = 100)
    tkadd(pw, lpw.2, minsize = 70)
    but <- tk2button(lpw.2, text = "OK", width = 10,
        command = function() tkdestroy(tt2))
    tkgrid(but)
    tkpack(pw, fill = "both", expand = "yes")
    # Resize the window and move the panel separator with the mouse

    ## A tk2combobox example
    tt2 <- tktoplevel()
    cb <- tk2combobox(tt2)
    tkgrid(cb)
    # Fill the combobox list
    fruits <- c("Apple", "Orange", "Banana", "Pear")
        # TO DO: change this!!!
        #for (i in (1:4))
    #    tk2listinsert(cb, "end", fruits[i])
        tkinsert(cb, "end", "pear")
        #tkconfigure(cb, value = "Pear")        # Set the current value for the combobox
    # or better: link it to a variable
    Fruit <- tclVar("Pear")
    tkconfigure(cb, textvariable = Fruit)
    # Create a button to get the content of the combobox
    but <- tk2button(tt2, text = "OK", width = 10,
        command = function() {tkdestroy(tt2); cat(tclvalue(Fruit), "\n")})
    tkgrid(but)

    ### An example of a tk2spinbox widget
    tt2 <- tktoplevel()
    tspin <- tk2spinbox(tt2, relief = "groove", from = 2, to = 20, increment = 2)
    tkgrid(tspin)
    #tdial <- tk2dial(tt2, from = 0, to = 20, resolution = 0.5, width = 70,
    #   tickinterval = 2)
    #tkgrid(tdial)
    tbut <- tk2button(tt2, text = "OK", width = 10,
        command = function() tkdestroy(tt2))
    tkgrid(tbut)

    ## A tk2mclistbox example
    tt2 <- tktoplevel()
    mlb <- tk2mclistbox(tt2, width = 55, resizablecolumns = TRUE)
    # Define the columns
    tk2column(mlb, "add", "name", label = "First name", width = 20)
    tk2column(mlb, "add", "lastname", label = "Last name", width = 20)
    tk2column(mlb, "add", "org", label = "Organisation", width = 15)
    tkgrid(mlb)
    # Fill the multicolumn list (we can use a vector, or a matrix of character strings)
    item1 <- c("Bryan", "Oackley", "ChannelPoint")
    items <- matrix(c("John", "Ousterhout", "Scriptics",
                      "Steve", "Miller", "TclTk inc."), ncol = 3, byrow = TRUE)
    tk2insert.multi(mlb, "end", item1)
    tk2insert.multi(mlb, "end", items)
    #### TO DO: bind events
    # Ex: .listbox label bind date <ButtonPress-1> "sortByDate 
    # See the example.tcl in .\libs\mclistbox1.02 for a more complex example
    # Create a button to close the dialog box
    but <- tk2button(tt2, text = "OK", width = 10,
        command = function() tkdestroy(tt2))
    tkgrid(but)

    ### A simple tk2table example
    myRarray <- c("Animal", "\"sphinx moth\"", "oyster",
                  "Type", "insect", "mollusk")
    dim(myRarray) <- c(3, 2)
    for (i in (0:2))
      for (j in (0:1))
         .Tcl(paste("set tclarray(", i, ",", j, ") ", myRarray[i+1, j+1], sep = ""))
    tt2 <- tktoplevel()
    table1 <- tk2table(tt2, variable = "tclarray", rows = "3",
        cols = "2", titlerows = "1", selectmode = "extended", colwidth = "25",
        background = "white")
    tkpack(table1)
  ## End(Not run)
\end{ExampleCode}
\end{Examples}

