Description Methods and Functions Hierarchy Interfaces Detailed Description Structures Convenient Construction Properties Author(s) References
Prompt the user for a file or directory name
gtkFileSelectionNew(title = NULL, show = TRUE)
gtkFileSelectionComplete(object, pattern)
gtkFileSelectionShowFileopButtons(object)
gtkFileSelectionHideFileopButtons(object)
gtkFileSelectionSetSelectMultiple(object, select.multiple)
gtkFileSelectionGetSelectMultiple(object)
gtkFileSelection(title = NULL, show = TRUE)
1 2 3 4 5 6 7 8 9 | GObject
+----GInitiallyUnowned
+----GtkObject
+----GtkWidget
+----GtkContainer
+----GtkBin
+----GtkWindow
+----GtkDialog
+----GtkFileSelection
|
GtkFileSelection implements
AtkImplementorIface and GtkBuildable
.
GtkFileSelection
has been superseded by the newer GtkFileChooser
family
of widgets.
GtkFileSelection
should be used to retrieve file or directory names from
the user. It will create a new dialog window containing a directory list,
and a file list corresponding to the current working directory. The filesystem
can be navigated using the directory list or the drop-down history menu.
Alternatively, the TAB key can be used to navigate using filename
completion - common in text based editors such as emacs and jed.
File selection dialogs are created with a call to gtkFileSelectionNew
.
The default filename can be set using gtkFileSelectionSetFilename
and the selected filename retrieved using gtkFileSelectionGetFilename
.
Use gtkFileSelectionComplete
to display files and directories
that match a given pattern. This can be used for example, to show only
*.txt files, or only files beginning with gtk*.
Simple file operations; create directory, delete file, and rename file, are available from buttons at the top of the dialog. These can be hidden using gtkFileSelectionHideFileopButtons
and shown again using gtkFileSelectionShowFileopButtons
.
Getting a filename from the user.
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 | # Getting a filename from a user
# Note how much easier GtkFileChooser is to use
store_filename <- function(widget, file_selector) {
selected_filename <- file_selector$getFilename();
print(paste("Selected filename:", selected_filename))
}
create_file_selection <- function() {
## Create the selector
file_selector <- gtkFileSelection("Please select a file for editing.",
show = FALSE)
gSignalConnect(file_selector[["ok_button"]], "clicked", store_filename,
file_selector)
## Ensure that the dialog box is destroyed when the user clicks a button.
gSignalConnect(file_selector[["ok_button"]], "clicked", gtkWidgetDestroy,
file_selector, user.data.first = TRUE)
gSignalConnect(file_selector[["cancel_button"]], "clicked", gtkWidgetDestroy,
file_selector, user.data.first = TRUE)
## Display that dialog
file_selector$show()
}
|
GtkFileSelection
WARNING: GtkFileSelection
is deprecated and should not be used in newly-written code.
The GtkFileSelection
struct contains the following GtkWidget
fields:
dirList
[GtkWidget
]
fileList
[GtkWidget
]
selectionEntry
[GtkWidget
]
selectionText
[GtkWidget
]
mainVbox
[GtkWidget
]
okButton
[GtkWidget
]
cancelButton
[GtkWidget
] the two main buttons that signals should be connected
to in order to perform an action when the user hits either OK or
Cancel.
helpButton
[GtkWidget
]
historyPulldown
[GtkWidget
] the GtkOptionMenu
used to create the drop-down
directory history.
historyMenu
[GtkWidget
]
fileopDialog
[GtkWidget
]
fileopEntry
[GtkWidget
] the dialog box used to display the GtkFileSelection
.
It can be customized by adding/removing widgets from it using the
standard GtkDialog
functions.
fileopFile
[character]
fileopCDir
[GtkWidget
]
fileopDelFile
[GtkWidget
]
fileopRenFile
[GtkWidget
]
buttonArea
[GtkWidget
]
actionArea
[GtkWidget
] the buttons that appear at the top of the file
selection dialog. These "operation buttons" can be hidden and
redisplayed with gtkFileSelectionHideFileopButtons
and
gtkFileSelectionShowFileopButtons
respectively.
gtkFileSelection
is the equivalent of gtkFileSelectionNew
.
filename
[character : * : Read / Write]The currently selected filename. Default value: NULL
select-multiple
[logical : Read / Write]Whether to allow multiple files to be selected. Default value: FALSE
show-fileops
[logical : Read / Write]Whether buttons for creating/manipulating files should be displayed. Default value: TRUE
Derived by RGtkGen from GTK+ documentation
https://developer.gnome.org/gtk2/stable/GtkFileSelection.html
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.