gimage: Constructor to show images

Description Usage Arguments Details See Also Examples

View source: R/gimage.R

Description

This constructor produces a widget intended to show images stored as files on the file system.

Usage

1
2
gimage(filename = "", dirname = "",  size = "", 
    handler = NULL, action = NULL, container = NULL, ..., toolkit = guiToolkit()) 

Arguments

filename

Specifies location of image. May be a stock icon name or filename. (In the future may be a url.)

dirname

Directory of file. If "stock", then a stock icon is used.

size

Size of image when stock image is used. Values are in c("menu", "small_toolbar","large_toolbar","button","dialog")

handler

Handler called on a click event

action

Passed to handler

container

Optional container to attach widget to.

...

Passed to add method of container

toolkit

Which GUI toolkit to use

Details

The svalue() method returns the filename of the figure or the stock icon name, if the icon was set from a stock icon.

The svalue<-() method can be used to set the value of the widget. The value is a filename containing the image to display.

The addhandlerclicked method is called on click events.

See Also

See getStockIcons to get a list of available icons and addStockIcons to add to this list.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
## Not run: 
   w <- gwindow("Stock icon example")
   gimage("ok",dirname="stock", container = w)

   ## example contributed by Richard Cotton

w <- gwindow("Help button window")
add_help_button <- function(help_text, container = w,
                            width = getOption("width"), indent = 2, ...) {
  gimage("help",	      
         dirname   = "stock",
         container = container,
         handler   = function(h, ...) {
           help_win <- gwindow("Help")
           help_label <- glabel(text= strwrap(help_text, width = width, indent = indent),
                                container = help_win)
         })
}

add_help_button(paste("Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
                      "Nunc magna magna, vestibulum sit amet posuere sit amet, gravida placerat odio.",
                      "Integer et purus lorem, quis suscipit risus.", collapse=" "))


## End(Not run)

gWidgets documentation built on May 2, 2019, 6:22 p.m.