Package 'rChoiceDialogs'

Title: 'rChoiceDialogs' Collection
Description: Collection of portable choice dialog widgets.
Authors: Alex Lisovich [aut, cre], Roger Day [aut], Sun Microsystems, Inc [cph] (swing-layout-1.0.4.jar, download from http://www.java2s.com/Code/Jar/s/Downloadswinglayout104jar.htm)
Maintainer: Alex Lisovich <[email protected]>
License: LGPL (>= 2.1)
Version: 1.0.6.1
Built: 2024-11-22 06:30:43 UTC
Source: CRAN

Help Index


rChoiceDialogs.

Description

Package: rChoiceDialogs
Type: Package
Version: 1.0.4
Date: 2012-10-11
License: GPL (>= 2)
LazyLoad: yes

Author(s)

Alex Lisovich, Roger Day


Check if Java graphics can be used

Description

Check if Java graphics can be used

Usage

canUseJava()

Value

TRUE if Java graphics can be used and FALSE otherwise.

Author(s)

Alex Lisovich, Roger Day


Check if modal Java dialogs can be used

Description

Check if modal Java dialogs can be used

Usage

canUseJavaModal()

Value

TRUE if modal Java dialogs can be used and FALSE otherwise.

Author(s)

Alex Lisovich, Roger Day


Check if Tcl/Tk graphics can be used

Description

Check if Tcl/Tk graphics can be used

Usage

canUseTclTk()

Value

TRUE if Tcl/Tk graphics can be used and FALSE otherwise.

Author(s)

Alex Lisovich, Roger Day


Choose a list of files interactively using the command line

Description

Allows to choose files or directories using the using the command line based interaction providing the same functionality as GUI counterparts without using any graphical framework.

Usage

cmdchoose.files(default = getwd(),
    caption = "Select files", multi = TRUE,
    dir.only = FALSE, filters = getDefaultFilters(),
    index = nrow(filters))

Arguments

default

Which filename or directory to show initially. Default is current work directory.

caption

The caption on the file selection dialog

multi

Whether to allow multiple files to be selected

dir.only

If TRUE (default is FALSE) works as directory chooser.

filters

A matrix of filename filters. If NULL, all files are shown. Default is filters=getDefaultFilters().

index

Which row of filters to use by default.

Value

A character vector giving zero or more file paths. If user cancels operation, character(0) is returned.

Note

cmdchoose.files() is called internally by rchoose.files() if neither Java nor TclTk are available Calling cmdchoose.files() directly forces the package to use command line interaction regardless of system capabilities and therefore may fail. Use the direct call to cmdchoose.files() only if it seems beneficial to bypass the rchoose.files() decision logic.

Author(s)

Alex Lisovich, Roger Day

See Also

getDefaultFilters, rchoose.files, canUseJavaModal

Examples

## Not run: 
cmdchoose.files();

## End(Not run)

Get default set of filters

Description

Get default set of filters

Usage

getDefaultFilters()

Value

Default set of filters for jchoose.files

Author(s)

Alex Lisovich, Roger Day

See Also

jchoose.files, tkchoose.files, rchoose.files


Choose a directory interactively using rJava

Description

Provides the same functionality as choose.dir from utils package, but relies on Java and rJava package and therefore is system independent provided Java 1.5 and higher is installed.

Usage

jchoose.dir(default = getwd(),
    caption = "Select Directory",
    modal = canUseJavaModal())

Arguments

default

Which filename or directory to show initially. Default is current work directory.

caption

The caption on the file selection dialog

modal

Indicates how the modality of the dialog is implemented. If TRUE, the modal dialog is used and if FALSE, R repeatedly checks for dialog status (active or not). The latter is used to refresh R Gui window on Windows. Default is canUseJavaModal().

Value

A character vector giving zero or more file paths. If user cancels operation, character(0) is returned.

Note

jchoose.dir() is called internally by rchoose.dir() if it's appropriate for a given platform/graphics combination. Calling jchoose.dir() directly forces the package to use Java based dialog regardless of system capabilities and therefore may fail. Use the direct call to jchoose.dir() only if it seems beneficial to bypass the rchoose.dir() decision logic.

Author(s)

Alex Lisovich, Roger Day

See Also

rchoose.dir, canUseJavaModal

Examples

## Not run: 
jchoose.dir();

## End(Not run)

Choose a list of files interactively using rJava

Description

Provides the same functionality as choose.files from utils package, but relies on Java and rJava package and therefore is system independent provided Java 1.5 and higher is installed.

Usage

jchoose.files(default = getwd(),
    caption = "Select files", multi = TRUE,
    filters = getDefaultFilters(), index = nrow(filters),
    modal = canUseJavaModal())

Arguments

default

Which filename or directory to show initially. Default is current work directory.

caption

The caption on the file selection dialog

multi

Whether to allow multiple files to be selected

filters

A matrix of filename filters. If NULL, all files are shown. Default is filters=getDefaultFilters().

index

Which row of filters to use by default.

modal

Indicates how the modality of the dialog is implemented. If TRUE, the modal dialog is used and if FALSE, R repeatedly checks for dialog status (active or not). The latter is used to refresh R Gui window on Windows. Default is canUseJavaModal().

Value

A character vector giving zero or more file paths. If user cancels operation, character(0) is returned.

Note

jchoose.files() is called internally by rchoose.files() if it's appropriate for a given platform/graphics combination. Calling jchoose.files() directly forces the package to use Java based dialog regardless of system capabilities and therefore may fail. Use the direct call to jchoose.files() only if it seems beneficial to bypass the rchoose.files() decision logic.

Author(s)

Alex Lisovich, Roger Day

See Also

getDefaultFilters, rchoose.files, canUseJavaModal

Examples

## Not run: 
jchoose.files();

## End(Not run)

Select item(s) from a list.

Description

Provides the same functionality as choose.files from utils package, but relies on Java and rJava package and therefore is system independent provided Java 1.5 and higher is installed. This brings up a modal dialog box with a (scrollable) list of items, which can be selected by the mouse. If multiple is true, further items can be selected or deselected by holding the control key down whilst selecting, and shift-clicking can be used to select ranges. Normal termination is via the 'OK' button or by hitting Enter or double-clicking an item. Selection can be aborted via the 'Cancel' button or pressing Escape. If no graphical widget is available it displays a text list from which the user can choose by number(s). The multiple = FALSE case uses menu. Preselection is only supported for multiple = TRUE, where it is indicated by a '+' preceding the item. It is an error to use select.list in a non-interactive session.

Usage

jselect.list(choices, preselect = NULL, multiple = FALSE,
    title = NULL, modal = canUseJavaModal())

Arguments

choices

A character vector of items.

preselect

A character vector, or NULL. If non-null and if the string(s) appear in the list, the item(s) are selected initially.

multiple

Logical: can more than one item be selected?

title

Optional character string for window title, or NULL for no title.

modal

Indicates how the modality of the dialog is implemented. return A character vector of selected items. If multiple is false and no item was selected (or Cancel was used), ” is returned. If multiple is true and no item was selected (or Cancel was used) then a character vector of length 0 is returned.

Note

jselect.list() is called internally by rchoose.list() if it's appropriate for a given platform/graphics combination. Calling jselect.list() directly forces the package to use Java based dialog regardless of system capabilities and therefore may fail. Use the direct call to jselect.list() only if it seems beneficial to bypass the rchoose.list() decision logic.

Author(s)

Alex Lisovich, Roger Day

See Also

rselect.list, select.list

Examples

## Not run: 
jselect.list(c("Peter", "Alex", "Roger", "Leah"),title="Select", multiple=TRUE);

## End(Not run)

Choose directory interactively

Description

Provides the same functionality as choose.dir from the utils package for Windows, but is intended to be system independent.

Usage

rchoose.dir(default = getwd(),
    caption = "Select Directory")

Arguments

default

Which filename or directory to show initially. Default is current work directory.

caption

The caption on the file selection dialog

Value

A character vector giving zero or more file paths. If user cancels operation, character(0) is returned.

Author(s)

Alex Lisovich, Roger Day

See Also

getDefaultFilters, jchoose.files, tkchoose.files, canUseJava, canUseTclTk

Examples

## Not run: 
rchoose.dir();

## End(Not run)

Choose a list of files interactively

Description

Provides the same functionality as choose.files from the utils package for Windows, but is intended to be system independent.

Usage

rchoose.files(default = getwd(),
    caption = "Select files", multi = TRUE,
    filters = getDefaultFilters(), index = nrow(filters))

Arguments

default

Which filename or directory to show initially. Default is current work directory.

caption

The caption on the file selection dialog

multi

Whether to allow multiple files to be selected

filters

A matrix of filename filters. If NULL, all files are shown. Default is filters=getDefaultFilters().

index

Which row of filters to use by default.

Value

A character vector giving zero or more file paths. If user cancels operation, character(0) is returned.

Author(s)

Alex Lisovich, Roger Day

See Also

getDefaultFilters, jchoose.files, tkchoose.files, canUseJava, canUseTclTk

Examples

## Not run: 
rchoose.files();

## End(Not run)

Select item(s) from a list.

Description

Provides the same functionality as select.list from the utils package, but is intended to broaden the range of systems where selection can be made through the graphical dialog provided Java 1.5 or higher is installed. This brings up a modal dialog box with a (scrollable) list of items, which can be selected by the mouse. If multiple is true, further items can be selected or deselected by holding the control key down whilst selecting, and shift-clicking can be used to select ranges. Normal termination is via the 'OK' button or by hitting Enter or double-clicking an item. Selection can be aborted via the 'Cancel' button or pressing Escape. If no graphical widget is available it displays a text list from which the user can choose by number(s). The multiple = FALSE case uses menu. Preselection is only supported for multiple = TRUE, where it is indicated by a '+' preceding the item. It is an error to use rselect.list in a non-interactive session.

Usage

rselect.list(choices, preselect = NULL, multiple = FALSE,
    title = NULL, graphics = getOption("menu.graphics"))

Arguments

choices

A character vector of items.

preselect

A character vector, or NULL. If non-null and if the string(s) appear in the list, the item(s) are selected initially.

multiple

Logical: can more than one item be selected?

title

Optional character string for window title, or NULL for no title.

graphics

logical indicating if a graphical widget should be used. return A character vector of selected items. If multiple is false and no item was selected (or Cancel was used), ” is returned. If multiple is true and no item was selected (or Cancel was used) then a character vector of length 0 is returned.

Author(s)

Alex Lisovich, Roger Day

See Also

jselect.list, select.list

Examples

## Not run: 
rselect.list(c("Peter", "Alex", "Roger", "Leah"),title="Select", multiple=TRUE);

## End(Not run)

Choose a list of files interactively using tcltk

Description

Provides the same functionality as choose.files from utils package for Windows, but relies on tcltk package and therefore is system independent provided tcltk is installed.

Usage

tkchoose.files(default = "", caption = "Select files",
    multi = TRUE, filters = getDefaultFilters(),
    index = nrow(filters))

Arguments

default

Which filename to show initially

caption

The caption on the file selection dialog

multi

Whether to allow multiple files to be selected

filters

A matrix of filename filters. If NULL, all files are shown. Default is filters=getDefaultFilters().

index

Which row of filters to use by default.

Value

A character vector giving zero or more file paths. If user cancels operation, character(0) is returned.

Note

tkchoose.files() is called internally by rchoose.files() if it's appropriate for a given platform/graphics combination. Calling tkchoose.files() directly forces the package to use tcl tk based dialog regardless of system capabilities and therefore may fail. Use the direct call to tkchoose.files() only if it seems beneficial to bypass the rchoose.files() decision logic.

Author(s)

Alex Lisovich, Roger Day

See Also

getDefaultFilters, rchoose.files

Examples

## Not run: 
tkchoose.files();

## End(Not run)