File: ex-gwindow.R

package info (click to toggle)
r-cran-gwidgets 0.0-54.2-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 2,360 kB
  • sloc: sh: 13; makefile: 2
file content (53 lines) | stat: -rw-r--r-- 1,142 bytes parent folder | download
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
## Test whether a main window works with
## * menubar
## * toolbar
## * content area
## * statusbar


## toolbar style
style="both"


f <- function(...) print("hi")

a <- gaction(label="action", icon = "quit", handler = f)

mbl <- list(File=list(
              save=gaction("save", icon="save",handler=f),
              test=a)
            )
tbl <- list(file=gaction("save",icon="save",handler=f),
            test = a,
            stop = gaction("stop", icon="stop",handler=function(...) dispose(w)),
            quit1 = gaction("quit", icon="quit",handler=f)
            )

w <- gwindow("test window", visible=FALSE)
mb <- gmenu(mbl, cont=w)
tb <- gtoolbar(tbl, cont=w, style=style)
## main content
txt <- gtext(cont=w)
sb <- gstatusbar("status", cont=w)


## test statusbar
svalue(sb) <- "This was added to status bar"

## test window
svalue(w) <- "title added via svalue"


visible(w) <- TRUE


## tests for RUnit
test.gwindow <- function() {
  title <- "test"
  w <- gwindow(title)
  checkEquals(svalue(w), title)
  svalue(w) <- toupper(title)
  checkEquals(svalue(w), toupper(title))
  dispose(w)
  checkException(svalue(w) <- title)
}