# GUI Examples

## GUIs

There are several ways to add interactivity to an Rpad page. From simplest to complex, some possibilities are:

- Rpad GUI tools -- Through the Rpad menu, you can add links, checkboxes, and radio buttons (if the GUI is enabled).
- Copy and paste -- You can paste widgets from other web pages or other web-page design programs.
- Handmade -- You can hand enter the html or use other html design programs to generate more complex widgets, including javascript if needed.
- R generation -- For more complex entries or when the gui element is based on server-side data, it is easier to generate the GUI elements on the server.

The basic GUI elements that are "named" are translated into variables with the same name in R. Here are some basic elements:

Pepperoni Sausage Extra cheese Mushrooms Peppers Onions

Favorite number

(This button just does the same as F9 or the Calculate menu item.)

Here is a dropdown list generated by R:

    HTMLon() # switch to html mode
    data(state)
    HTMLselect("favoriteAmericanState", state.name) # generate the select box

After fiddling with some of the inputs, hit F9 or the calculate button and see that the following outputs change:

    cat("isPepperoni =",isPepperoni,"\n")
    cat("browserDropdown =",browserDropdown,"\n")
    cat("favoriteNumber =",favoriteNumber,"\n")
    cat("favoriteAmericanState =",favoriteAmericanState,"\n")

by Tom Short, tshort@epri.com, Copyright 2005. EPRI, license: GNU GPL v2 or greater