Crea  Modifica  FrontPage  Indici  Cerca  Ultime modifiche  History  RSS  Login

Gtk::FileChooserButton

class Gtk::FileChooserButton

The Gtk::FileChooserButton is a widget that lets the user select a file. It includes the Gtk::FileChooser module. Visually, it is a file name with a button to bring up a Gtk::FileChooserDialog. The user can then use that dialog to change the file associated with that button. This widget does not support setting the "select-multiple" property to true.

Example 5. Create a button to let the user select a file in /etc

button = Gtk::FileChooserButton.new("Select a file", 
                                    Gtk::FileChooser::ACTION_OPEN)
button.current_folder = "/etc"

The Gtk::FileChooserButton supports the Gtk::FileChooser::Action s Gtk::FileChooser::ACTION_OPEN and Gtk::FileChooser::ACTION_SELECT_FOLDER.

Important
The Gtk::FileChooserButton will ellipsize the label, and thus will thus request little horizontal space. To give the button more space, you should call Gtk::Widget#size_request, Gtk::FileChooserButton#width_chars=, or pack the button in such a way that other interface elements give space to the widget.

Class Methods

Gtk::FileChooserButton.new(title, action, backend = nil)
Creates a new file-selecting button widget. Since 2.6
  • title: the title of the browse dialog.
  • action: the open mode for the widget. (Gtk::FileChooser::Action)
  • backend: The name of the specific filesystem backend to use or nil. (e.g.) "gnome-vfs"
  • Returns: a new Gtk::FileChooserButton widget.
Gtk::FileChooserButton.new(dialog)
Creates a Gtk::FileChooserButton widget which uses dialog as it's file-picking window. Note that dialog must be a Gtk::FileChooserDialog (or subclass). Since 2.6
title
Retrieves the title of the browse dialog used by button. Since 2.6
  • Returns: The title of the file chooser dialog.
title=(title)
Modifies the title of the browse dialog used by button. Since 2.6
  • title: the new browse dialog title.
  • Returns: title
set_title(title)
Same as Gtk::FileChooserButton.title=. Since 2.6
  • title: the new browse dialog title.
  • Returns: self
width_chars
Retrieves the width in characters of the button widget's entry and/or label. Since 2.6
  • Returns: an Integer width (in characters) that the button will use to size itself.
width_chars=(n_chars)
Sets the width (in characters) that button will use to n_chars. Since 2.6
  • n_chars: the new width, in characters.
  • Returns: n_chars
set_width_chars(n_chars)
Same as Gtk::FileChooserButton.width_chars=. Since 2.6
  • n_chars: the new width, in characters.
  • Returns: self
dialog=(dialog)
Sets the Gtk::FileChooserDialog to use. Since 2.6
set_dialog(dialog)
Same as Gtk::FileChooserButton.dialog=. Since 2.6

Properties

dialog: Gtk::FileChooserDialog (Write)
The file chooser dialog to use. Since 2.6
title: String (Read/Write)
The title of the file chooser dialog. Since 2.6
width-chars: Integer (Read/Write)
The desired width of the button widget, in characters. Since 2.6

ChangeLog

  • 2005-03-07 Added - Masao
Ultima modifica:2007/03/02 00:31:29
Parola chiave:
Referenze:[Gtk::FileChooser] [Gtk::FileChooserButton]