Learn R Programming

PBSmodelling (version 2.70.2)

selectDir: Display Dialogue: Select directory

Description

Display and select a system directory using a call to tcltk::tkchooseDirectory.

Usage

selectDir(initialdir=getwd(), mustexist=TRUE, title="", usewidget=NULL,
   targetdir=NULL, relative=FALSE)

Value

The directory path selected by the user.

Arguments

initialdir

character -- initially selected directory

mustexist

logical -- if TRUE, only an existing directory can be selected

title

character -- title for the prompt window

usewidget

character -- store the selected directory in the named entry widget

targetdir

character -- a alternative directory to initialdir from which to start a search

relative

logical -- if TRUE, express the selected directory relative to initialdir or targetdir

Author

Alex Couture-Beil, Software Engineer, Earthly Technologies, Victoria BC

Maintainer: Rowan Haigh, Program Head -- Offshore Rockfish
Pacific Biological Station (PBS), Fisheries & Oceans Canada (DFO), Nanaimo BC
locus opus: remote office, Vancouver BC
Last modified Rd: 2025-05-26

Details

When used in a GUI, the coupling of selectDir with setGUIoptions necessarily ties the initialdir to the usewidget directory. A new argument targetdir allows the user to specify an alternative directory from which to search that is independent of the initialdir-usewidget coupling.

See Also

In package PBSmodelling:
selectFile, setGUIoptions

Examples

Run this code
if (FALSE) {
local(envir=.PBSmodEnv,expr={
  dir(selectDir(title="select a directory to list contents of"))

  #integration with widget via doAction
  createWin( c( "entry foo mode=character width=25", 
    "button text=\"select dir\" 
    func=doAction action=\"selectDir(usewidget=`foo`)\"" ), astext=TRUE )
})
}

Run the code above in your browser using DataLab