#
Prev |  | Next

# fileChooser

## Name

fileChooser -- A standard dialog to choose a file

## Synopsis

fileChooser [`-option` `value`...]

## Screenshot

## Options

-action

  type: ONEOF open, save, openFolder, createFolder (default: open)

  Action to perform.

-currentName

  type: string (default: "")

  Current name in the file selector, as if entered by the user. This should be used for example in a "Save as" dialog to suggest a name.

-currentFilder

  type: string (default: "")

  Current folder.

-extraWidget

  type: string (default: "")

  ID of a Gnocl widget, for extra options.

-filename

  type: string (default: "")

  Current filename.

-getURIs

  type: boolean (default: 0)

  Whether to return URIs instead of file names. (This is not yet tested.)

-localOnly

  type: boolean

  Whether only local files can be chosen.

-name

  type: string

  Name of the widget, can be used to set options in an rc file.

-onDestroy

  type: string (default: "")

  Tcl command which is executed if the widget is destroyed. Before evaluation the following percent strings are substituated: TABLE %% | % %w | widget name. TABLE

-onUpdatePreview

  type: string (default: "")

  Tcl command to be executed, if the preview widget has to be updated. Before evaluation the following percent strings are substituted: TABLE %% | % %w | widget name /TABLE

-previewWidget

  type: string (default: "")

  ID of a Gnocl widget to display a custom preview of the currently selected file.

-previewWidgetActive

  type: bool (default: 1)

  Whether the preview widget is active.

-selectMultiple

  type: bool (default: 0)

  Whether multiple files may be selected.

-showHidden

  type: bool (default: 0)

  Whether hidden files are shown.

-title

  type: string (default: "")

  Title of the dialog. -visible; boolean; 1 Whether or not the item is visible.

## Description

This command is available since GTK+ 2.4. A fileChooser is used to let the user choose a directory or one or more files in a standardized way. The commands returns a list of files if multiple files can be chosen. Otherwise it returns directly the directory of file chosen.

## Commands

`id` delete

  Deletes the widget and the associated tcl command.

`id` configure [`-option` `value`...]

  Configures the widget. Option may have any of the values accepted on creation of the widget.

`id` cget `option`

  Returns the value for one option. The option may have any of the values accepted by configure.

## Example

    proc doPreview { widget file } {
       set preview [$widget cget -previewWidget]
       if { [catch {$preview configure -visible 1 -image %/$file} erg] } {
          $preview configure -visible 0
       }
       $widget configure -previewWidgetActive 1
    }
    set file [gnocl::fileChooser -title "Please choose a picture file" -previewWidget [gnocl::image] -onUpdatePreview "doPreview %w %f"]

results in

## See also

colorSelection, fontSelection, `GtkFileChooser`

Prev | Home | Next
colorSelection | Up | fontButton