rgtkgwidgets

Allowing gframe to grow with scrollbars inside window


I'd like to create a variable number of widgets inside a frame, based on data imported by the user, while keeping the frame from growing the window off the screen. If the frame becomes larger than the window or its container, I want it to show a scrollbar instead of expanding any further.

Minimal example demonstrating the issue:

library(gWidgets)
library(gWidgetsRGtk2)
options("guiToolkit"="RGtk2")

win <- gwindow(height = 200)

pane <- gpanedgroup(container = win, horizontal = TRUE)
frame <- gframe("frame",container = pane,horizontal = FALSE)

for (counter in seq_len(50)) {
  gcheckbox("check", container = frame)
}

The goal is to have frame be scrollable. Adding scrolling options like the below did not help:

pane <- gpanedgroup(container = win, horizontal = TRUE, expand = FALSE)
frame <- gframe("frame",container = pane,horizontal = FALSE, use.scrollwindow=TRUE)

Solution

  • As jverzani stated in the comments, placing the objects to scroll in a ggroup with use.scrollwindow=TRUE and expand=TRUE creates the desired behavior.